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 }