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.
|
|
|
import {Template} from "../Template"
|
|
|
|
import {UniversalPath} from "@extollo/util"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Template that generates a new controller in the app/http/controllers directory.
|
|
|
|
*/
|
|
|
|
const controller_template: Template = {
|
|
|
|
name: 'controller',
|
|
|
|
fileSuffix: '.controller.ts',
|
|
|
|
description: 'Create a controller class that can be used to handle requests.',
|
|
|
|
baseAppPath: ['http', 'controllers'],
|
|
|
|
render(name: string, fullCanonicalName: string, targetFilePath: UniversalPath) {
|
|
|
|
return `import {Controller, view} from "@extollo/lib"
|
|
|
|
import {Inject, Injectable} from "@extollo/di"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ${name} Controller
|
|
|
|
* ------------------------------------
|
|
|
|
* Put some description here.
|
|
|
|
*/
|
|
|
|
@Injectable()
|
|
|
|
export class ${name} extends Controller {
|
|
|
|
public ${name.toLowerCase()}() {
|
|
|
|
return view('${name.toLowerCase()}')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export { controller_template }
|