This commit is contained in:
syuilo
2017-12-17 01:41:22 +09:00
parent b563a67b8a
commit 0769566408
24 changed files with 65 additions and 42 deletions

View File

@@ -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']
@@ -63,12 +68,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
*/