1 | const path = require('path');
|
2 | const express = require('express');
|
3 | const serveStatic = require('serve-static');
|
4 | const swaggerUi = require('swagger-ui-dist');
|
5 | const config = require('./config');
|
6 |
|
7 | module.exports = (callback) => {
|
8 | const app = express();
|
9 |
|
10 | app.use('/docs', serveStatic(path.resolve(__dirname)));
|
11 |
|
12 | app.use(serveStatic(swaggerUi.getAbsoluteFSPath()));
|
13 |
|
14 | app.listen(config.port, () => {
|
15 | console.log('Listening on port %d', config.port);
|
16 |
|
17 | callback(config);
|
18 | });
|
19 | };
|