Proxy the fahrplan
This commit is contained in:
parent
e5245d82a0
commit
0978d1df8d
2 changed files with 14 additions and 0 deletions
|
@ -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
10
server/route/35c3.js
Normal 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;
|
||||
});
|
||||
};
|
Loading…
Reference in a new issue