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