md-toy-blog
Version:
Very simple Markdown blog: serves your md as html without fancy databases. You will only spend time writing the actual data.
15 lines (13 loc) • 457 B
text/typescript
export default class ViewNameService {
constructor(private config: { viewsPath: string; }) {}
getViewBaseName(controller: {}): string {
const fullName = controller.constructor.name;
return fullName
.substring(0, fullName.length - 'Controller'.length)
.toLowerCase();
}
getViewPath(viewBaseName: string, action: string) {
const filepath = `${this.config.viewsPath}/${viewBaseName}-${action}.html`;
return filepath;
}
}