Files
lib/src/cli/templates/controller.ts
garrettmills 1d5056b753
All checks were successful
continuous-integration/drone/push Build is passing
Setup eslint and enforce rules
2021-06-02 22:36:25 -05:00

30 lines
749 B
TypeScript

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 }