Pre-render ReDoc

redoc-cliはexpandResponsesは200のみとすると数値と認識されてしまい設定できないため202,204という指定にしています
This commit is contained in:
tamaina
2020-04-03 17:13:41 +09:00
parent 9e9d378bf1
commit 795fb0eb60
11 changed files with 885 additions and 112 deletions

View File

@ -15,7 +15,6 @@ import * as MarkdownIt from 'markdown-it';
import packFeed from './feed';
import { fetchMeta } from '../../misc/fetch-meta';
import { genOpenapiSpec } from '../api/openapi/gen-spec';
import config from '../../config';
import { Users, Notes, Emojis, UserProfiles, Pages } from '../../models';
import parseAcct from '../../misc/acct/parse';
@ -97,13 +96,15 @@ router.get('/api-doc', async ctx => {
});
});
router.get('/api.json', async ctx => {
await send(ctx as any, '/assets/api.json', {
root: client
});
});
// URL preview endpoint
router.get('/url', require('./url-preview'));
router.get('/api.json', async ctx => {
ctx.body = genOpenapiSpec();
});
router.get('/docs.json', async ctx => {
const lang = ctx.query.lang;
if (!Object.keys(locales).includes(lang)) {