@chubbyts/chubbyts-framework
Version:
A minimal, highly performant middleware PSR-15 inspired function based microframework built with as little complexity as possible, aimed primarily at those developers who want to understand all the vendors they use.
21 lines (20 loc) • 981 B
TypeScript
import type { Container } from '@chubbyts/chubbyts-dic-types/dist/container';
import type { Middleware } from '@chubbyts/chubbyts-http-types/dist/middleware';
/**
* ```ts
* import type { Container } from '@chubbyts/chubbyts-dic-types/dist/container';
* import { createContainer } from '@chubbyts/chubbyts-dic/dist/container';
* import type { Middleware } from '@chubbyts/chubbyts-http-types/dist/middleware';
* import type { Logger } from 'some-logger/dist/logger';
* import { createLazyMiddleware } from '@chubbyts/chubbyts-framework/dist/middleware/lazy-middleware';
*
* const container: Container = createContainer();
*
* container.set('middlewareServiceId', (container: Container): Middleware => {
* return createMyMiddleware(container.get<Logger>('logger'));
* });
*
* const middleware: Middleware = createLazyMiddleware(container, 'middlewareServiceId');
* ```
*/
export declare const createLazyMiddleware: (container: Container, id: string) => Middleware;