rudeshark.net/src/server/web/docs.ts

25 lines
417 B
TypeScript
Raw Normal View History

2017-12-16 17:41:22 +01:00
/**
* Docs Server
*/
2018-04-09 11:54:03 +02:00
import * as path from 'path';
2017-12-16 17:41:22 +01:00
import * as express from 'express';
2018-04-09 11:54:03 +02:00
const docs = path.resolve(`${__dirname}/../../client/docs/`);
2018-03-29 13:50:45 +02:00
2017-12-16 17:41:22 +01:00
/**
* Init app
*/
const app = express();
app.disable('x-powered-by');
2018-03-29 13:50:45 +02:00
app.use('/assets', express.static(`${docs}/assets`));
2017-12-16 17:41:22 +01:00
/**
* Routing
*/
app.get(/^\/([a-z_\-\/]+?)$/, (req, res) =>
2018-03-29 13:50:45 +02:00
res.sendFile(`${docs}/${req.params[0]}.html`));
2017-12-16 17:41:22 +01:00
module.exports = app;