Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import {AfterRoutesInit} from "@tsed/common";
import {Constant, Module} from "@tsed/di";
import {$log} from "ts-log-debug";
import {ISeqSettings} from "./interfaces/ISeqSettings";
@Module()
export class SeqModule implements AfterRoutesInit {
@Constant("seq", {
url: "http://localhost:5341"
})
private config: ISeqSettings;
$afterRoutesInit() {
$log.appenders.set("seq", {
type: "seq",
levels: ["info", "debug", "trace", "fatal", "error", "warn"],
url: this.config.url,
apiKey: this.config.apiKey
});
}
}
import {InjectorService, Module, ProviderType} from "@tsed/di";
import {ConverterModule} from "../converters/ConverterModule";
import {JsonSchemesService} from "../jsonschema";
import {ControllerBuilder} from "./builders/ControllerBuilder";
import {ControllerProvider} from "./models/ControllerProvider";
import {ParseService} from "./services/ParseService";
import {RouteService} from "./services/RouteService";
import {ValidationService} from "./services/ValidationService";
@Module({
imports: [InjectorService, ConverterModule, ParseService, ValidationService, JsonSchemesService, RouteService]
})
export class MvcModule {
constructor(injector: InjectorService) {
const routers = injector
.getProviders(ProviderType.CONTROLLER)
.map(provider => {
if (!provider.hasParent()) {
return new ControllerBuilder(provider as ControllerProvider).build(injector);
}
})
.filter(Boolean);
return {routers};
}
}