Import other modules into monorepo
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
31
src/cli/templates/controller.ts
Normal file
31
src/cli/templates/controller.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import {Template} from "../Template"
|
||||
import {UniversalPath} from "../../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 }
|
||||
Reference in New Issue
Block a user