How to use the @tsed/di.GlobalProviders.createRegisterFn function in @tsed/di

To help you get started, we’ve selected a few @tsed/di examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TypedProject / ts-express-decorators / packages / common / src / mvc / registries / MiddlewareRegistry.ts View on Github external
* }
 *
 * registerMiddleware({provide: FooMiddleware});
 * // or
 * registerMiddleware(FooMiddleware);
 *
 * const injector = new InjectorService()
 * injector.load();
 *
 * const myFooService = injector.get(FooMiddleware);
 * fooMiddleware.use(); // test
 * ```
 *
 * @param provider Provider configuration.
 */
export const registerMiddleware = GlobalProviders.createRegisterFn(ProviderType.MIDDLEWARE);
github TypedProject / ts-express-decorators / packages / common / src / converters / registries / ConverterRegistries.ts View on Github external
* }
 *
 * registerConverter({provide: MyConverter});
 * // or
 * registerConverter(MyConverter);
 *
 * const injector = new InjectorService();
 * injector.load();
 *
 * const myConverter = injector.get(MyConverter);
 * myConverter.serialize(); // test
 * ```
 *
 * @param provider Provider configuration.
 */
export const registerConverter = GlobalProviders.createRegisterFn(ProviderType.SERVICE);