aboutsummaryrefslogtreecommitdiff
path: root/routes/meetingpointProxy.js
blob: cec74a873c388452d5cd5725d3d4045dea4e2a58 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
var express = require('express')
var router = express.Router()
const Promise = require('bluebird')
const request = Promise.promisify(require('request'))
const encoding = require('encoding')

/* 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)
})

module.exports = router