rainbox.email/src/controllers/HomeController.ts

29 lines
863 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";
import config from "config";
2020-04-23 18:07:55 +02:00
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, 'back');
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> {
res.render('about', {
instance_url: config.get('public_url'),
});
2020-04-23 18:07:55 +02:00
}
2020-10-05 13:38:03 +02:00
protected async getAbout(req: Request, res: Response): Promise<void> {
res.redirect(Controller.route('home'));
2020-04-23 18:07:55 +02:00
}
/**
* 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
}