Skip to content

Instantly share code, notes, and snippets.

View NikhilNanjappa-zz's full-sized avatar

Nikhil Nanjappa NikhilNanjappa-zz

View GitHub Profile
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,
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 {
await strapi.plugins['email'].services.email.send({
to: ctx.request.body.to,
from: 'your@address.com',
replyTo: 'your@address.com',
subject: 'My message',
text: 'Text',
html: '<h1>Text</h1>'
}, config);
{
"routes": [
{
"method": "POST",
"path": "/email",
"handler": "Email.send",
"config": {
"policies": []
}
},
{
"pdfUrls": {
"production": "example pdf url changed again"
}
}
@NikhilNanjappa-zz
NikhilNanjappa-zz / callGeneratePdf.js
Last active April 28, 2018 03:03
PDF Store Server
const docDefinition = {
content: ['This will show up in the file created']
};
generatePdf(docDefinition, (response) => {
// doc successfully created
res.json({
status: 200,
data: response
});