From a3120b142985135fae4ec2b5c533eeac9800b3d4 Mon Sep 17 00:00:00 2001 From: sodoku Date: Tue, 22 Jan 2019 22:05:18 +0100 Subject: [PATCH] Add proxy for c-base calendar json --- server/index.js | 2 ++ server/route/calendar.js | 10 ++++++++++ 2 files changed, 12 insertions(+) create mode 100644 server/route/calendar.js diff --git a/server/index.js b/server/index.js index 4110091..4e3de82 100644 --- a/server/index.js +++ b/server/index.js @@ -7,12 +7,14 @@ const path = require('path'); const routePictures = require('./route/pictures'); const route35c3 = require('./route/35c3'); +const routeCalendar = require('./route/calendar'); const app = new Koa(); const router = new Router(); route35c3(router); routePictures(router); +routeCalendar(router); app .use(Cors()) diff --git a/server/route/calendar.js b/server/route/calendar.js new file mode 100644 index 0000000..bc67e7f --- /dev/null +++ b/server/route/calendar.js @@ -0,0 +1,10 @@ +require('isomorphic-fetch'); + +module.exports = (router) => { + router.get('/calendar', async (ctx) => { + const res = await fetch('https://www.c-base.org/calendar/exported/events.json'); + ctx.assert((res.status === 200), res.status); + const body = await res.json(); + ctx.body = body; + }); +};