This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express') | |
const app = express() | |
const nunjucks = require('nunjucks') | |
const path = require('path') | |
nunjucks.configure([ | |
path.join(__dirname, 'node_modules/govuk-frontend/'), | |
path.join(__dirname, 'app/views/') | |
], { | |
autoescape: true, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const formidable = require('formidable'); | |
module.exports = function (req, res, next) { | |
const formData = new formidable.IncomingForm(); | |
formData | |
.parse(req, (err, fields, files) => { | |
if (err) { | |
next(err); | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
await strapi.plugins['email'].services.email.send({ | |
to: ctx.request.body.to, | |
from: '[email protected]', | |
replyTo: '[email protected]', | |
subject: 'My message', | |
text: 'Text', | |
html: '<h1>Text</h1>' | |
}, config); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"routes": [ | |
{ | |
"method": "POST", | |
"path": "/email", | |
"handler": "Email.send", | |
"config": { | |
"policies": [] | |
} | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"pdfUrls": { | |
"production": "example pdf url changed again" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const docDefinition = { | |
content: ['This will show up in the file created'] | |
}; | |
generatePdf(docDefinition, (response) => { | |
// doc successfully created | |
res.json({ | |
status: 200, | |
data: response | |
}); |