(flavor) swagger v3.0.0

master
Devin Ivy 2021-04-11 23:24:17 -04:00 committed by cemal
parent e131da0931
commit a36720a54d
3 changed files with 33 additions and 2 deletions

View File

@ -11,7 +11,7 @@
}, },
"scripts": { "scripts": {
"start": "node server", "start": "node server",
"test": "lab -a @hapi/code -L", "test": "lab -a @hapi/code -I \"__core-js_shared__,CSS,regeneratorRuntime,core\" -L",
"lint": "eslint ." "lint": "eslint ."
}, },
"dependencies": { "dependencies": {
@ -25,7 +25,9 @@
"@hapi/eslint-plugin-hapi": "4.x.x", "@hapi/eslint-plugin-hapi": "4.x.x",
"@hapi/glue": "8.x.x", "@hapi/glue": "8.x.x",
"@hapi/hapi": "20.x.x", "@hapi/hapi": "20.x.x",
"@hapi/inert": "6.x.x",
"@hapi/lab": "24.x.x", "@hapi/lab": "24.x.x",
"@hapi/vision": "6.x.x",
"@hapipal/confidence": "6.x.x", "@hapipal/confidence": "6.x.x",
"@hapipal/hpal": "3.x.x", "@hapipal/hpal": "3.x.x",
"@hapipal/hpal-debug": "2.x.x", "@hapipal/hpal-debug": "2.x.x",
@ -33,6 +35,7 @@
"babel-eslint": "10.x.x", "babel-eslint": "10.x.x",
"dotenv": "8.x.x", "dotenv": "8.x.x",
"eslint": "7.x.x", "eslint": "7.x.x",
"exiting": "6.x.x" "exiting": "6.x.x",
"hapi-swagger": "14.x.x"
} }
} }

View File

@ -33,6 +33,9 @@ module.exports = new Confidence.Store({
plugin: '../lib', // Main plugin plugin: '../lib', // Main plugin
options: {} options: {}
}, },
{
plugin: './plugins/swagger'
},
{ {
plugin: { plugin: {
$filter: 'NODE_ENV', $filter: 'NODE_ENV',

25
server/plugins/swagger.js Normal file
View File

@ -0,0 +1,25 @@
'use strict';
const Inert = require('@hapi/inert');
const Vision = require('@hapi/vision');
const HapiSwagger = require('hapi-swagger');
const Package = require('../../package.json');
module.exports = {
name: 'app-swagger',
async register(server) {
await server.register([
Inert,
Vision,
{
plugin: HapiSwagger,
options: {
info: {
version: Package.version
}
}
}
]);
}
};