diff options
author | BuildTools <Noah Loomans> | 2017-01-07 22:37:16 +0100 |
---|---|---|
committer | BuildTools <Noah Loomans> | 2017-01-07 22:37:16 +0100 |
commit | 549364fb691f7f092223e186033a8138c3ead2fd (patch) | |
tree | bec1b0bbc972a08ff69464853190044780eb667d /routes/meetingpointProxy.js | |
parent | 4e8da42863406764a659a7337e774ad216d356c9 (diff) | |
parent | a5238353ab86923bb3911e0bf2886ebcb53dfbd2 (diff) |
Merge branch 'beta'
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 |