Skip to content

Commit 2a479ff

Browse files
committed
(flavor) swagger v3.0.0
1 parent 839e7af commit 2a479ff

File tree

3 files changed

+33
-2
lines changed

3 files changed

+33
-2
lines changed

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"main": "lib/index.js",
55
"scripts": {
66
"start": "node server",
7-
"test": "lab -a @hapi/code -L",
7+
"test": "lab -a @hapi/code -I \"__core-js_shared__,CSS,regeneratorRuntime,core\" -L",
88
"lint": "eslint ."
99
},
1010
"dependencies": {
@@ -18,14 +18,17 @@
1818
"@hapi/eslint-plugin-hapi": "4.x.x",
1919
"@hapi/glue": "8.x.x",
2020
"@hapi/hapi": "20.x.x",
21+
"@hapi/inert": "6.x.x",
2122
"@hapi/lab": "24.x.x",
23+
"@hapi/vision": "6.x.x",
2224
"@hapipal/confidence": "6.x.x",
2325
"@hapipal/hpal": "3.x.x",
2426
"@hapipal/hpal-debug": "2.x.x",
2527
"@hapipal/toys": "3.x.x",
2628
"babel-eslint": "10.x.x",
2729
"dotenv": "8.x.x",
2830
"eslint": "7.x.x",
29-
"exiting": "6.x.x"
31+
"exiting": "6.x.x",
32+
"hapi-swagger": "14.x.x"
3033
}
3134
}

server/manifest.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ module.exports = new Confidence.Store({
3333
plugin: '../lib', // Main plugin
3434
options: {}
3535
},
36+
{
37+
plugin: './plugins/swagger'
38+
},
3639
{
3740
plugin: {
3841
$filter: 'NODE_ENV',

server/plugins/swagger.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
'use strict';
2+
3+
const Inert = require('@hapi/inert');
4+
const Vision = require('@hapi/vision');
5+
const HapiSwagger = require('hapi-swagger');
6+
const Package = require('../../package.json');
7+
8+
module.exports = {
9+
name: 'app-swagger',
10+
async register(server) {
11+
12+
await server.register([
13+
Inert,
14+
Vision,
15+
{
16+
plugin: HapiSwagger,
17+
options: {
18+
info: {
19+
version: Package.version
20+
}
21+
}
22+
}
23+
]);
24+
}
25+
};

0 commit comments

Comments
 (0)