-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.js
More file actions
28 lines (22 loc) · 679 Bytes
/
Copy pathapp.js
File metadata and controls
28 lines (22 loc) · 679 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
28
'use strict';
const controllerLoader = require('./lib/controller_loader');
const swaggerLoader = require('./lib/swagger_loader');
const swaggerUI = require('./lib/swagger_ui');
const SwaggerRouter = require('./lib/swagger_router');
module.exports = app => {
app.swagger = swaggerLoader(app);
if (app.config.swaggerbox.ui.enable) {
swaggerUI(app);
}
app.beforeStart(async () => {
if (app.config.swaggerbox.router.enable) {
controllerLoader(app);
const swaggerRouter = new SwaggerRouter(
app,
app.config.swaggerbox.router
);
await swaggerRouter.init();
app.emit('swagger-router-initial-finished');
}
});
};