Add MailController helper class

This commit is contained in:
Alice Gaudon 2020-06-03 14:14:42 +02:00
parent ad0bb3d023
commit 6a4b44035e
2 changed files with 15 additions and 1 deletions

View File

@ -1,6 +1,6 @@
{
"name": "wms-core",
"version": "0.4.33",
"version": "0.4.34",
"description": "Node web framework",
"repository": "git@gitlab.com:ArisuOngaku/wms-core.git",
"author": "Alice Gaudon <alice@gaudon.pro>",

View File

@ -0,0 +1,14 @@
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);
}
private async getMail(request: Request, response: Response) {
const template = request.params['template'];
response.send(Mail.parse(`mails/${template}.mjml.njk`, request.query, false));
}
}