swaf/src/auth/MailController.ts

14 lines
469 B
TypeScript

import {Request, Response} from "express";
import Controller from "../Controller";
import Mail from "../Mail";
export default class MailController extends Controller {
routes(): void {
this.get("/mail/:template", this.getMail, 'mail');
}
private async getMail(request: Request, response: Response) {
const template = request.params['template'];
response.send(Mail.parse(`mails/${template}.mjml.njk`, request.query, false));
}
}