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.

21 lines
784 B

import { InstantiableCanonical } from './InstantiableCanonical.ts'
import { CanonicalDefinition } from './Canonical.ts'
import Controller from '../http/Controller.ts'
import { Unit } from '../lifecycle/decorators.ts'
@Unit()
export default class Controllers extends InstantiableCanonical {
protected base_path = './app/http/controllers'
protected canonical_item = 'controller'
protected suffix = '.controller.ts'
public async init_canonical_item(def: CanonicalDefinition) {
const item = await super.init_canonical_item(def)
if ( !(item instanceof Controller) ) {
throw new TypeError(`Invalid controller definition: ${def.original_name}. Controllers must extend from Daton's base Controller class.`)
}
return item
}
}