mailtrain/server/routes/rest/editors.js
2020-08-30 23:43:59 -05:00

16 lines
440 B
JavaScript

'use strict';
const passport = require('../../lib/passport');
const bluebird = require('bluebird');
const htmlToText = require('html-to-text');
const router = require('../../lib/router-async').create();
router.postAsync('/html-to-text', passport.loggedIn, passport.csrfProtection, async (req, res) => {
const email = htmlToText.fromString(req.body.html, {wordwrap: 130});
res.json({text: email});
});
module.exports = router;