adding some cors to allow silvrtree to get the stuff

This commit is contained in:
Martin Donnelly 2018-01-14 18:45:02 +00:00
parent c105c28050
commit cb0f85e772

View File

@ -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);