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.3.0 to 2.0.0

.travis.yml

5

bin/mock-routes.js
var t = require('joi');
var handler = function(request) {
request.reply('ok');
var handler = function(request, reply) {
reply('ok');
};

@@ -7,0 +6,0 @@

@@ -28,6 +28,7 @@ var Hapi = require('hapi'),

server.start(function(){
console.log('Server running at:', server.info.uri);
console.log('server running at:', server.info.uri);
});
});
server.route(Routes);
server.route(Routes);

12

package.json
{
"name": "hapi-swagger",
"description": "A swagger documentation UI generator plugin for hapi",
"version": "1.3.0",
"version": "2.0.0",
"author": "Glenn Jones",

@@ -21,7 +21,7 @@ "repository": {

"dependencies": {
"handlebars": "^1.3.0",
"handlebars": "^4.0.0",
"boom": "^2.8.0",
"hoek": "^2.14.0",
"joi": "~6.6.1",
"shortid": "^2.2.2"
"joi": "~6.7.0",
"shortid": "^2.2.2"
},

@@ -34,3 +34,3 @@ "devDependencies": {

"chai": "^1.9.2",
"hapi": "^9.0.1",
"hapi": "^10.0.0",
"istanbul": "^0.3.17"

@@ -42,4 +42,4 @@ },

"peerDependencies": {
"hapi": "^9.0.1"
"hapi": "^9.0.1 || ^10.0.0"
}
}
# hapi-swagger
This is a [Swagger UI](https://github.com/wordnik/swagger-ui) plug-in for [HAPI](http://hapijs.com/) v9.x or v10.x When installed it will self document HTTP API interface in a project.
This is a [Swagger UI](https://github.com/wordnik/swagger-ui) plug-in for [HAPI](http://hapijs.com/) v9.x When installed it will self document HTTP API interface in a project.
[![build status](https://img.shields.io/travis/glennjones/hapi-swagger.svg?style=flat-square)](http://travis-ci.org/glennjones/hapi-swagger)
[![npm downloads](https://img.shields.io/npm/dm/hapi-swagger.svg?style=flat-square)](https://www.npmjs.com/package/hapi-swagger)
[![MIT license](http://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://raw.github.com/glennjones/microformat-shic/master/license.txt)
[![npm downloads](https://img.shields.io/npm/dm/hapi-swagger.svg?style=flat-square)](https://www.npmjs.com/package/hapi-swaggered-ui)
## Install

@@ -14,3 +15,3 @@

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

@@ -177,3 +178,3 @@ $ npm install inert --save

* `auth`: string The auth strategy to use if enableDocumentationPage is `true` - default: `false`,
* `endpoint`: string the JSON endpoint that descibes the API - default: `/docs`
* `endpoint`: string the JSON endpoint that describes the API - default: `/docs`
* `pathPrefixSize`: number Selects what segment of the URL path is used to group endpoints - default: `1`

@@ -260,7 +261,7 @@ * `payloadType`: string Weather accepts `json` or `form` parameters for payload - default: `json`

### File upload
The plug-in has basic support for file uploads into your API's. Below is an example of a route with a file uplaod, the three important elements are:
The plug-in has basic support for file uploads into your API's. Below is an example of a route with a file upload, the three important elements are:
* `payloadType: 'form'` in the plugins section creates a form for upload
* `.meta({ swaggerType: 'file' })` add to the payload property you wish to be file upload
* `payload` cnfiguration how HAPI will process file
* `payload` configuration how HAPI will process file
```Javascript

@@ -293,3 +294,3 @@ {

```
The https://github.com/glennjones/be-more-hapi project has an example of file upload with the handler function dealing with validation, sch as filetype and schema validation.
The https://github.com/glennjones/be-more-hapi project has an example of file upload with the handler function dealing with validation, such as filetype and schema validation.

@@ -296,0 +297,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