diff options
author | Noah Loomans <noahloomans@gmail.com> | 2017-01-08 11:48:13 +0100 |
---|---|---|
committer | Noah Loomans <noahloomans@gmail.com> | 2017-01-08 11:48:13 +0100 |
commit | 320c18af3ee9cbeaaae3d4796dd7f15a5ac90889 (patch) | |
tree | d63339d425a2a6a20c883d896b9ed492272d6085 /routes/meetingpointProxy.js | |
parent | 4e8da42863406764a659a7337e774ad216d356c9 (diff) | |
parent | dea89e1ec600b302a8db33dd48080b901aee7c7e (diff) |
Merge branch 'master' of github.com:nloomans/rooster-mml
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 |