2020-06-03 14:14:42 +02:00
|
|
|
import {Request, Response} from "express";
|
|
|
|
import Controller from "../Controller";
|
|
|
|
import Mail from "../Mail";
|
|
|
|
|
|
|
|
export default class MailController extends Controller {
|
|
|
|
routes(): void {
|
2020-07-15 11:42:49 +02:00
|
|
|
this.get("/mail/:template", this.getMail, 'mail');
|
2020-06-03 14:14:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
private async getMail(request: Request, response: Response) {
|
|
|
|
const template = request.params['template'];
|
|
|
|
response.send(Mail.parse(`mails/${template}.mjml.njk`, request.query, false));
|
|
|
|
}
|
|
|
|
}
|