aboutsummaryrefslogtreecommitdiff
path: root/routes/meetingpointProxy.js
blob: 68f3fdf0cba9df04f58ea28b1460408991c77b32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
const express = require('express')
const router = express.Router()
const request = require('request')
const iconv = require('iconv-lite')

router.get('/:url', function (req, res, next) {
  const url = `http://www.meetingpointmco.nl/${req.params.url}`
  request(url, { encoding: null }, function (err, data) {
    if (err) {
      next(err)
      return
    }

    const utf8Body = iconv.decode(data.body, 'ISO-8859-1')
    res.status(data.statusCode).end(utf8Body)
  })
})

module.exports = router