mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-08 22:43:09 +02:00
27 lines
469 B
TypeScript
27 lines
469 B
TypeScript
/**
|
|
* Docs
|
|
*/
|
|
|
|
import ms = require('ms');
|
|
import * as Router from 'koa-router';
|
|
import * as send from 'koa-send';
|
|
|
|
const docs = `${__dirname}/../../client/docs/`;
|
|
|
|
const router = new Router();
|
|
|
|
router.get('/assets/*', async ctx => {
|
|
await send(ctx, ctx.params[0], {
|
|
root: docs + '/assets/',
|
|
maxage: ms('7 days'),
|
|
immutable: true
|
|
});
|
|
});
|
|
|
|
router.get('*', async ctx => {
|
|
await send(ctx, `${ctx.params[0]}.html`, {
|
|
root: docs
|
|
});
|
|
});
|
|
|
|
export default router;
|