import { Router } from 'express'; import mailer from "../../src/mailer"; const buildEmail = (data, user) => { const human = [ `
${data[field]}`: data[field]}
${tsv.join('\t')}`; } const router = Router(); router.post('/sources/submit/:locale', async (req, res) => { const emailBody = buildEmail(req.body, req.user); for (let admin of process.env.MAILER_ADMINS.split(',')) { mailer(admin, `[Pronouns][${req.params.locale}] Source submission`, undefined, emailBody); } return res.json({ result: 'ok' }); }); export default router;