-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #103 from sima-land/38-examples-bun
Шаг 56 #38
- Loading branch information
Showing
14 changed files
with
237 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
/* eslint-disable require-jsdoc, jsdoc/require-jsdoc */ | ||
import type { Handler } from '../../../../http'; | ||
import type { ServerHandler } from '../../../server/types'; | ||
import { KnownToken } from '../../../../tokens'; | ||
import { CURRENT_APP, type Application, type Resolve } from '../../../../di'; | ||
|
||
export function HandlerProvider(getApp: () => Application) { | ||
return (resolve: Resolve): Handler => { | ||
return (resolve: Resolve): ServerHandler => { | ||
const parent = resolve(CURRENT_APP); | ||
|
||
return request => { | ||
return (request, context) => { | ||
const app = getApp(); | ||
|
||
app.attach(parent); | ||
app.bind(KnownToken.Http.Handler.context).toValue({ request }); | ||
app.bind(KnownToken.Http.Handler.context).toValue({ request, ...context }); | ||
|
||
return app.get(KnownToken.Http.Handler.main)(request); | ||
return app.get(KnownToken.Http.Handler.main)(request, context); | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export type { HandlerContext } from './types'; | ||
export type { ExpressHandlerContext } from './types'; | ||
export { PresetNode } from './node'; | ||
export { PresetHandler, HandlerProvider } from './handler'; |
Oops, something went wrong.