Last active
June 11, 2019 09:07
-
-
Save anthonycoffey/256d21b2a60b7aed49075880fe37e705 to your computer and use it in GitHub Desktop.
Implementation of Custom Highcharts Export Module
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 router = express.Router(); | |
const exportCharts = require('./modules/export-charts.js'); // this is my export module | |
router.post('/mbd', async function(req,res){ | |
exportCharts.initPool(); | |
const chartOptions = req.body; | |
const exportSettings = { | |
type: 'jpeg', | |
options: chartOptions, | |
scale: 2, | |
}; | |
const chart = await exportCharts.export(exportSettings) | |
.then(response => { | |
return response; | |
}) | |
.catch(error => { | |
return error; | |
}); | |
exportCharts.killPool(); | |
res.status(200).send({chart}); | |
}); | |
module.exports = router |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment