2017-12-16 16:41:22 +00:00
|
|
|
/**
|
2018-04-12 21:06:18 +00:00
|
|
|
* Docs
|
2017-12-16 16:41:22 +00:00
|
|
|
*/
|
|
|
|
|
2018-04-09 09:54:03 +00:00
|
|
|
import * as path from 'path';
|
2018-04-12 21:06:18 +00:00
|
|
|
import * as Router from 'koa-router';
|
|
|
|
import * as send from 'koa-send';
|
2017-12-16 16:41:22 +00:00
|
|
|
|
2018-04-09 09:54:03 +00:00
|
|
|
const docs = path.resolve(`${__dirname}/../../client/docs/`);
|
2018-03-29 11:50:45 +00:00
|
|
|
|
2018-04-12 21:06:18 +00:00
|
|
|
const router = new Router();
|
2017-12-16 16:41:22 +00:00
|
|
|
|
2018-04-12 21:06:18 +00:00
|
|
|
router.get('/assets', async ctx => {
|
|
|
|
await send(ctx, `${docs}/assets`);
|
|
|
|
});
|
2017-12-16 16:41:22 +00:00
|
|
|
|
2018-04-12 21:06:18 +00:00
|
|
|
router.get(/^\/([a-z_\-\/]+?)$/, async ctx => {
|
|
|
|
await send(ctx, `${docs}/${ctx.params[0]}.html`);
|
|
|
|
});
|
2017-12-16 16:41:22 +00:00
|
|
|
|
2018-04-12 21:06:18 +00:00
|
|
|
module.exports = router;
|