express-joi-simple
Advanced tools
Comparing version 1.0.4 to 1.0.5
{ | ||
"name": "express-joi-simple", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -44,2 +44,25 @@ # Express + Joi + Swagger | ||
Use require instead of import for plain Javascript. | ||
More complicated example you can find in example folder. | ||
More complicated example you can find in example folder. | ||
## Swagger documentation settings example: | ||
``` | ||
const settings = { | ||
info: { | ||
"version": "1.0.0", | ||
"title": "Title Example", | ||
"description": "Description API example", | ||
"termsOfService": "http://swagger.io/terms/", | ||
"contact": { | ||
"name": "Example team" | ||
}, | ||
"license": { | ||
"name": "MIT" | ||
} | ||
}, | ||
host: 'localhost:3000', | ||
basePath: '/' | ||
} | ||
``` | ||
Doc(app, settings); |
@@ -7,5 +7,7 @@ | ||
export function Doc(app: any, info?: any) { | ||
Swagger.swaggerDoc.createJsonDoc(info); | ||
export function Doc(app: any, settings?: any) { | ||
const {info, host, basePath} = settings; | ||
Swagger.swaggerDoc.createJsonDoc(info, host, basePath); | ||
app._router.stack.forEach((middleware: any) => { | ||
@@ -12,0 +14,0 @@ if (middleware.route) { // routes registered directly on the app |
@@ -6,2 +6,3 @@ import * as express from 'express'; | ||
import { Doc, Validate, RequestHandler } from '../index'; | ||
import { settings } from './settings'; | ||
@@ -30,3 +31,3 @@ const app = express(); | ||
app.listen(3000, () => { | ||
Doc(app); | ||
Doc(app, settings); | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17835
26
269
68