Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import {GlobalProviders, ProviderType, TypedProvidersRegistry} from "@tsed/di";
import {ControllerProvider} from "../models/ControllerProvider";
import {ExpressRouter} from "../services/ExpressRouter";
// tslint:disable-next-line: variable-name
export const ControllerRegistry: TypedProvidersRegistry = GlobalProviders.createRegistry(ProviderType.CONTROLLER, ControllerProvider, {
injectable: false,
onInvoke(provider: ControllerProvider, locals: any) {
locals.set(ExpressRouter, provider.router);
}
});
import {GlobalProviders, Provider, ProviderType, TypedProvidersRegistry} from "@tsed/di";
/**
*
* @type {Registry, Provider>}
*/
// tslint:disable-next-line: variable-name
export const MiddlewareRegistry: TypedProvidersRegistry = GlobalProviders.createRegistry(ProviderType.MIDDLEWARE, Provider, {
injectable: true,
buildable: true
});
/**
* Add a new middleware in the `ProviderRegistry`. This middleware will be built when `InjectorService` will be loaded.
*
* #### Example
*
* ```typescript
* import {registerMiddleware, InjectorService} from "@tsed/common";
*
* export default class FooMiddleware {
* constructor(){}
* use() {
* return "test";
* }
import {Provider, ProviderType, TypedProvidersRegistry, GlobalProviders} from "@tsed/di";
/**
* Converter Registry.
* @type {Registry, IProvider>}
*/
// tslint:disable-next-line: variable-name
export const ConverterRegistry: TypedProvidersRegistry = GlobalProviders.createRegistry(ProviderType.CONVERTER, Provider, {
injectable: true
});
/**
* Add a new converter in the `ProviderRegistry`. This converter will be built when `InjectorService` will be loaded.
*
* #### Example
*
* ```typescript
* import {registerConverter, InjectorService} from "@tsed/common";
*
* export default class MyConverter {
* constructor(){}
* serialize() {
* return "test";
* }
* }