You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lib/src/views/ViewEngineFactory.ts

24 lines
763 B

import {Instantiable, FactoryProducer} from '../di'
import {ViewEngine} from './ViewEngine'
import {PugViewEngine} from './PugViewEngine'
import {ConfiguredSingletonFactory} from '../di/factory/ConfiguredSingletonFactory'
/**
* Dependency factory whose token matches the abstract ViewEngine class, but produces
* a particular ViewEngine implementation based on the configuration.
*/
@FactoryProducer()
export class ViewEngineFactory extends ConfiguredSingletonFactory<ViewEngine> {
protected getConfigKey(): string {
return 'server.view_engine.driver'
}
protected getDefaultImplementation(): Instantiable<ViewEngine> {
return PugViewEngine
}
protected getAbstractImplementation(): any {
return ViewEngine
}
}