forked from facundoolano/google-play-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
36 lines (27 loc) · 979 Bytes
/
server.js
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
28
29
30
31
32
33
34
35
36
'use strict';
import Express from 'express';
import router from './lib/index.js';
import swaggerDocument from './openapi/swagger.json' assert { type: "json" };
import swaggerUi from 'swagger-ui-express';
import morgan from 'morgan';
const app = Express();
const port = process.env.PORT || 3000;
var options = {
customCss: '.swagger-ui .topbar { display: none }'
};
app.use('/openapi.json', Express.static('openapi/swagger.json'));
app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerDocument, options));
app.use('/api/', router);
if (process.env.LOGGING || false) {
console.log('Logging is enabled');
app.use(morgan('combined'));
}
app.get('/', function (req, res) {
res.redirect('/api-docs');
});
app.use('/openapi.json', Express.static('openapi/swagger.json'));
app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerDocument, options));
app.use('/api/', router);
app.listen(port, function () {
console.log('Server started on port', port);
});