summaryrefslogtreecommitdiff
path: root/src/web/server.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/web/server.ts')
-rw-r--r--src/web/server.ts11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/web/server.ts b/src/web/server.ts
index 38e87754f3..062d1f197a 100644
--- a/src/web/server.ts
+++ b/src/web/server.ts
@@ -10,6 +10,9 @@ import * as express from 'express';
import * as bodyParser from 'body-parser';
import * as favicon from 'serve-favicon';
import * as compression from 'compression';
+import vhost = require('vhost');
+
+import config from '../conf';
/**
* Init app
@@ -17,6 +20,8 @@ import * as compression from 'compression';
const app = express();
app.disable('x-powered-by');
+app.use(vhost(`docs.${config.host}`, require('./docs/server')));
+
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json({
type: ['application/json', 'text/plain']
@@ -64,12 +69,6 @@ app.get('/manifest.json', (req, res) =>
app.get(/\/api:url/, require('./service/url-preview'));
/**
- * Docs
- */
-app.get(/^\/docs\/([a-z_\-\/]+?)$/, (req, res) =>
- res.sendFile(`${__dirname}/docs/${req.params[0]}.html`));
-
-/**
* Routing
*/
app.get('*', (req, res) => {