ily.li/src/controllers/HomeController.ts

26 lines
750 B
TypeScript
Raw Normal View History

2020-04-23 18:07:55 +02:00
import Controller from "wms-core/Controller";
import {Request, Response} from "express";
export default class HomeController extends Controller {
2020-10-05 13:38:03 +02:00
public routes(): void {
2020-04-23 18:07:55 +02:00
this.get('/', this.getHome, 'home');
this.get('/about', this.getAbout, 'about');
this.get('/back', this.goBack, 'about');
2020-04-23 18:07:55 +02:00
}
2020-10-05 13:38:03 +02:00
protected async getHome(req: Request, res: Response): Promise<void> {
2020-04-23 18:07:55 +02:00
res.render('home');
}
2020-10-05 13:38:03 +02:00
protected async getAbout(req: Request, res: Response): Promise<void> {
2020-04-23 18:07:55 +02:00
res.render('about');
}
/**
* This is to test and assert that wms-core extended types are available
*/
2020-10-05 13:38:03 +02:00
protected async goBack(req: Request, res: Response): Promise<void> {
res.redirectBack();
}
2020-10-05 13:38:03 +02:00
}