diff --git a/server.js b/server.js index 7d56002..54bbe95 100644 --- a/server.js +++ b/server.js @@ -16,6 +16,12 @@ const cache = apicache.middleware; app.use(express.static(path.join(__dirname, sitePath))); +app.all('/*', function(req, res, next) { + res.header("Access-Control-Allow-Origin", "*"); + res.header("Access-Control-Allow-Headers", "X-Requested-With"); + next(); +}); + app.use('/gettrains', cache('60 seconds'), train.getTrainTimes); app.use('/getnexttraintimes', cache('60 seconds'), train.getNextTrainTimes); app.use('/getroute', cache('60 seconds'), train.getRoute);