diff options
Diffstat (limited to 'routes')
-rw-r--r-- | routes/hello.js | 9 | ||||
-rw-r--r-- | routes/index.js | 26 | ||||
-rw-r--r-- | routes/meetingpointProxy.js | 19 |
3 files changed, 0 insertions, 54 deletions
diff --git a/routes/hello.js b/routes/hello.js deleted file mode 100644 index 6356b98..0000000 --- a/routes/hello.js +++ /dev/null @@ -1,9 +0,0 @@ -var express = require('express') -var router = express.Router() - -/* GET home page. */ -router.get('/', function (req, res, next) { - res.render('hello') -}) - -module.exports = router diff --git a/routes/index.js b/routes/index.js deleted file mode 100644 index d496b3c..0000000 --- a/routes/index.js +++ /dev/null @@ -1,26 +0,0 @@ -'use strict' - -const express = require('express') -const router = express.Router() -const getMeetingpointData = require('../lib/getMeetingpointData') - -/* GET home page. */ -router.get('/', function (req, res, next) { - getMeetingpointData().then(data => { - let flags = [] - if (req.query.nfd != null) { - flags.push('NO_FEATURE_DETECT') - } - - const flagsStr = `var FLAGS = ${JSON.stringify(flags)};` - const usersStr = `var USERS = ${JSON.stringify(data.users)};` - const validWeekNumbersStr = `var VALID_WEEK_NUMBERS = ${JSON.stringify(data.validWeekNumbers)}` - res.render('index', { flagsStr, usersStr, validWeekNumbersStr }) - }).catch(function () { - console.error('Unable to get user info, emergency redirect!') - // res.redirect('http://www.meetingpointmco.nl/Roosters-AL/doc/') - res.render('redirect') - }) -}) - -module.exports = router diff --git a/routes/meetingpointProxy.js b/routes/meetingpointProxy.js deleted file mode 100644 index 68f3fdf..0000000 --- a/routes/meetingpointProxy.js +++ /dev/null @@ -1,19 +0,0 @@ -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 |