From e74c1f2ac64be957cb43cc836d299710fd4537c5 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 6 Jul 2018 23:52:47 +0900 Subject: [PATCH] w --- src/server/api/call.ts | 2 +- src/server/api/endpoints/meta.ts | 2 +- src/server/web/docs.ts | 7 +++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/server/api/call.ts b/src/server/api/call.ts index fd3cea774..b1e166876 100644 --- a/src/server/api/call.ts +++ b/src/server/api/call.ts @@ -31,7 +31,7 @@ export default (endpoint: string | Endpoint, user: IUser, app: IApp, data: any, } } - let exec = require(`${__dirname}/endpoints/${ep.name}`); + let exec = require(`${__dirname}/endpoints/${ep.name}`).default; if (ep.withFile && file) { exec = exec.bind(null, file); diff --git a/src/server/api/endpoints/meta.ts b/src/server/api/endpoints/meta.ts index 836123a3a..64cf9db55 100644 --- a/src/server/api/endpoints/meta.ts +++ b/src/server/api/endpoints/meta.ts @@ -38,7 +38,7 @@ const client = require('../../../../built/client/meta.json'); /** * Show core info */ -export default (params: any) => new Promise(async (res, rej) => { +export default () => new Promise(async (res, rej) => { const meta: any = (await Meta.findOne()) || {}; res({ diff --git a/src/server/web/docs.ts b/src/server/web/docs.ts index c7430e073..e67070963 100644 --- a/src/server/web/docs.ts +++ b/src/server/web/docs.ts @@ -205,4 +205,11 @@ router.get('/*/api/entities/*', async ctx => { })); }); +router.get('/*/*', async ctx => { + const lang = ctx.params[0]; + const doc = ctx.params[1]; + + await ctx.render('../../../../src/client/docs/' + doc + '.' + lang, await genVars(lang)); +}); + export default router;