Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hapi-swagger

Package Overview
Dependencies
Maintainers
1
Versions
163
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hapi-swagger - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

66

bin/mock-routes.js

@@ -31,3 +31,4 @@ var t = require('joi');

}
}
},
tags: ['admin', 'api']
}

@@ -43,3 +44,4 @@ }, {

}
}
},
tags: ['admin', 'api']
}

@@ -55,3 +57,4 @@ }, {

}
}
},
tags: ['admin', 'api']
}

@@ -67,3 +70,4 @@ }, {

}
}
},
tags: ['admin', 'api']
}

@@ -79,17 +83,6 @@ }, {

}
}
},
tags: ['admin', 'api']
}
}, {
method: 'HEAD',
path: '/test',
config: {
handler: handler,
validate: {
query: {
param2: t.string().valid('first', 'last'),
param3: t.number().valid(42)
}
}
}
}, {
method: 'GET',

@@ -129,13 +122,2 @@ path: '/notincluded',

method: 'GET',
path: '/rootarray',
config: {
handler: handler,
validate: {
query: t.array().includes(t.string(), t.object({
param1: t.number()
})).excludes(t.number()).min(2).max(5).length(3)
}
}
}, {
method: 'GET',
path: '/path/{pparam}/test',

@@ -191,30 +173,2 @@ config: {

method: 'GET',
path: '/withpojoinarray',
config: {
handler: handler,
validate: {
query: {
param1: t.array().includes({
param2: t.string()
})
}
}
}
}, {
method: 'POST',
path: '/withnestedrulesarray',
config: {
handler: handler,
validate: {
payload: {
param1: t.array().includes(t.object({
param2: t.array().includes(t.object({
param3: t.string()
})).optional()
}))
}
}
}
}, {
method: 'GET',
path: '/withhtmlnote',

@@ -221,0 +175,0 @@ config: {

49

bin/test-server.js

@@ -0,27 +1,32 @@

var Hapi = require('hapi'),
Inert = require('inert'),
Vision = require('vision'),
Blipp = require('blipp'),
HapiSwagger = require('../'),
Pack = require('../package'),
Routes = require('./mock-routes');
var server = new Hapi.Server();
server.connection({
host: 'localhost',
port: 3000
});
var Hapi = require('hapi'),
swagger = require('../'),
pack = require('../package'),
routes = require('./mock-routes');
var server = new Hapi.Server(3004);
// setup swagger options
var swaggerOptions = {
basePath: 'http://localhost:3004',
apiVersion: pack.version
};
apiVersion: Pack.version
};
server.pack.register(require('../'), function(err) {
if(err){
console.log(['error'], 'plugin "hapi-swagger" load error: ' + err)
}else{
console.log(['start'], 'swagger interface loaded')
server.start(function(){
console.log(['start'], pack.name + ' - web interface: ' + server.info.uri);
server.register([
Inert,
Vision,
Blipp,
{
register: HapiSwagger,
options: swaggerOptions
}], function (err) {
server.start(function(){
console.log('Server running at:', server.info.uri);
});
}
});
server.route(routes);
});
server.route(Routes);
{
"name": "hapi-swagger",
"description": "A swagger documentation UI generator plugin for hapi",
"version": "1.1.0",
"version": "1.1.1",
"author": "Glenn Jones",

@@ -18,18 +18,19 @@ "repository": {

"engines": {
"node": ">=0.10.0"
"node": ">=0.10.40"
},
"dependencies": {
"boom": "2.x",
"handlebars": "1.3.x",
"hoek": "2.x",
"joi": "6.6.x",
"shortid": "2.2.x"
"handlebars": "^1.3.0",
"boom": "^2.8.0",
"hoek": "^2.14.0",
"joi": "~6.6.1",
"shortid": "^2.2.2"
},
"devDependencies": {
"inert": "3.x",
"vision": "2.x",
"mocha": "1.17.x",
"chai": "1.9.x",
"hapi": "9.x",
"istanbul": "0.3.x"
"inert": "^3.0.0",
"vision": "^2.0.1",
"blipp": "^2.1.3",
"mocha": "^1.17.1",
"chai": "^1.9.2",
"hapi": "^9.0.1",
"istanbul": "^0.3.17"
},

@@ -40,4 +41,4 @@ "scripts": {

"peerDependencies": {
"hapi": "9.x"
"hapi": "^9.0.1"
}
}

@@ -13,3 +13,3 @@ # hapi-swagger

You will alos need to install the `inert` and `vision` plugs-in which support tamplates and static content serving.
You will also need to install the `inert` and `vision` plugs-ins which support tamplates and static content serving.

@@ -21,3 +21,3 @@ $ npm install inert --save

In the apps main .js file add the following code to created a `server` object which makes use of the hapi-swagger plug-in:
In your apps main .js file add the following code to created a `server` object:

@@ -28,3 +28,3 @@ ```Javascript

Vision = require('vision'),
HapiSwagger = require('hapi-swagger');
HapiSwagger = require('hapi-swagger'),
Pack = require('./package');

@@ -50,6 +50,7 @@

server.start(function(){
// Add any server.route() config here
console.log('Server running at:', server.info.uri);
});
});
// Add any server.route() config here
```

@@ -56,0 +57,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc