diff --git a/package.json b/package.json index 3e349203fc..b611f603c9 100644 --- a/package.json +++ b/package.json @@ -150,6 +150,7 @@ "js-yaml": "3.11.0", "jsdom": "11.7.0", "koa": "^2.5.0", + "koa-bodyparser": "^4.2.0", "koa-favicon": "^2.0.1", "koa-mount": "^3.0.0", "koa-multer": "^1.0.2", diff --git a/src/server/index.ts b/src/server/index.ts index f0d60fa651..02362037ee 100644 --- a/src/server/index.ts +++ b/src/server/index.ts @@ -8,6 +8,7 @@ import * as https from 'https'; import * as Koa from 'koa'; import * as Router from 'koa-router'; import * as bodyParser from 'koa-bodyparser'; +import * as mount from 'koa-mount'; import activityPub from './activitypub'; import webFinger from './webfinger'; @@ -27,15 +28,17 @@ if (config.url.startsWith('https')) { }); } +app.use(mount('/api', require('./api'))); +app.use(mount('/files', require('./file'))); + // Init router const router = new Router(); // Routing -router.use('/api', require('./api')); -router.use('/files', require('./file')); router.use(activityPub.routes()); router.use(webFinger.routes()); -router.use(require('./web')); + +app.use(mount(require('./web'))); // Register router app.use(router.routes());