diff options
Diffstat (limited to 'routes/meetingpointProxy.js')
-rw-r--r-- | routes/meetingpointProxy.js | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/routes/meetingpointProxy.js b/routes/meetingpointProxy.js index cec74a8..b2b51c9 100644 --- a/routes/meetingpointProxy.js +++ b/routes/meetingpointProxy.js @@ -1,16 +1,17 @@ var express = require('express') var router = express.Router() -const Promise = require('bluebird') -const request = Promise.promisify(require('request')) -const encoding = require('encoding') +const request = require('request') /* GET home page. */ router.get('/:url', function (req, res, next) { - request(`http://www.meetingpointmco.nl/${req.params.url}`) - .then(raw => raw.body) - .then(page => encoding.convert(page, 'UTF-8', 'Windows-1252')) - .then(body => { res.end(body) }) - .catch(next) + const url = `http://www.meetingpointmco.nl/${req.params.url}` + request(url, function (err, data) { + if (err) { + next(err) + return + } + res.status(data.statusCode).end(data.body) + }) }) module.exports = router |