mailtrain/server/routes/rest/editors.js

17 lines
440 B
JavaScript
Raw Normal View History

2018-02-13 22:50:13 +00:00
'use strict';
const passport = require('../../lib/passport');
const bluebird = require('bluebird');
2020-08-31 04:43:59 +00:00
const htmlToText = require('html-to-text');
2018-02-13 22:50:13 +00:00
const router = require('../../lib/router-async').create();
router.postAsync('/html-to-text', passport.loggedIn, passport.csrfProtection, async (req, res) => {
2020-08-31 04:43:59 +00:00
const email = htmlToText.fromString(req.body.html, {wordwrap: 130});
2018-02-13 22:50:13 +00:00
2020-08-31 04:43:59 +00:00
res.json({text: email});
2018-02-13 22:50:13 +00:00
});
module.exports = router;