Add MailController helper class
This commit is contained in:
parent
ad0bb3d023
commit
6a4b44035e
@ -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>",
|
||||
|
14
src/auth/MailController.ts
Normal file
14
src/auth/MailController.ts
Normal 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));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user