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.
lib/src/cli/templates/middleware.ts

30 lines
675 B

import {Template} from '../Template'
/**
* Template that generates a new middleware class in app/http/middlewares.
*/
const templateMiddleware: Template = {
name: 'middleware',
fileSuffix: '.middleware.ts',
description: 'Create a middleware class that can be applied to routes.',
baseAppPath: ['http', 'middlewares'],
render(name: string) {
return `import {Middleware, Injectable} from '@extollo/lib'
/**
* ${name} Middleware
* --------------------------------------------
* Put some description here.
*/
@Injectable()
export class ${name} extends Middleware {
public async apply() {
}
}
`
},
}
export { templateMiddleware }