import {Request, Response} from "express"; import {route} from "swaf/common/Routing"; import Controller from "swaf/Controller"; export default class HomeController extends Controller { public routes(): void { this.get('/', this.getHome, 'home'); this.get('/about', this.getAbout, 'about'); this.get('/back', this.goBack, 'about'); } protected async getHome(req: Request, res: Response): Promise { res.render('home'); } protected async getAbout(req: Request, res: Response): Promise { res.render('about'); } /** * This is to test and assert that swaf extended types are available */ protected async goBack(req: Request, res: Response): Promise { res.redirect(req.getPreviousUrl() || route('home')); } }