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