-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
executable file
·27 lines (20 loc) · 847 Bytes
/
app.js
File metadata and controls
executable file
·27 lines (20 loc) · 847 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import * as ws from './socket';
import express from 'express';
import runner from 'swagger-node-runner';
import timeout from 'connect-timeout';
import { SwaggerUIBundle, SwaggerUIStandalonePreset } from "swagger-ui-dist";
import {web as config} from './config';
const swaggerUiAssetPath = require("swagger-ui-dist").getAbsoluteFSPath();
var app = express();
module.exports = app; // for testing
runner.create({ appRoot: __dirname }, function(err, swaggerRunner) {
if (err) { throw err; }
app.use(timeout(config.timeout)); // 10 minute
// install middleware
ws.register(app);
swaggerRunner.expressMiddleware().register(app);
app.use('/', express.static('public'));
app.use('/ui', express.static(swaggerUiAssetPath));
app.use('/swagger', express.static('api/swagger/swagger.yaml'));
ws.listen(app.listen(config.port));
});