Proxy the fahrplan

This commit is contained in:
Henri Bergius 2018-12-24 14:23:22 +01:00
parent e5245d82a0
commit 0978d1df8d
2 changed files with 14 additions and 0 deletions

View file

@ -4,9 +4,13 @@ const Static = require('koa-static');
const Cors = require('koa-cors');
const path = require('path');
const route35c3 = require('./route/35c3');
const app = new Koa();
const router = new Router();
route35c3(router);
app
.use(Cors())
.use(router.routes())

10
server/route/35c3.js Normal file
View file

@ -0,0 +1,10 @@
require('isomorphic-fetch');
module.exports = (router) => {
router.get('/35c3/fahrplan', async (ctx) => {
const res = await fetch('https://fahrplan.events.ccc.de/congress/2018/Fahrplan/schedule.json');
ctx.assert((res.status === 200), res.status);
const body = await res.json();
ctx.body = body;
});
};