From 2fcebdd2813a5019eceaf290c4bdfa4e47f65a92 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 17 Jun 2018 11:23:18 +0900 Subject: cors --- src/server/api/index.ts | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/server/api/index.ts b/src/server/api/index.ts index 009c99acae..23203d9147 100644 --- a/src/server/api/index.ts +++ b/src/server/api/index.ts @@ -6,6 +6,7 @@ import * as Koa from 'koa'; import * as Router from 'koa-router'; import * as multer from 'koa-multer'; import * as bodyParser from 'koa-bodyparser'; +const cors = require('@koa/cors'); import endpoints from './endpoints'; @@ -13,6 +14,7 @@ const handler = require('./api-handler').default; // Init app const app = new Koa(); +app.use(cors()); app.use(bodyParser({ // リクエストが multipart/form-data でない限りはJSONだと見なす detectJSON: ctx => !ctx.is('multipart/form-data') -- cgit v1.2.3-freya