swagger-ui-express
Advanced tools
Comparing version 1.0.2 to 1.0.3
36
index.js
'use strict' | ||
const fs = require('fs'); | ||
const express = require('express'); | ||
var fs = require('fs'); | ||
var express = require('express'); | ||
const explorerHtml = `<form id='api_selector'> | ||
<div class='input'><input placeholder="http://example.com/api" id="input_baseUrl" name="baseUrl" type="text"/></div> | ||
<div id='auth_container'></div> | ||
<div class='input'><a id="explore" class="header__btn" href="#" data-sw-translate>Explore</a></div> | ||
</form>` | ||
var explorerHtml = '<form id="api_selector">'+ | ||
'<div class="input"><input placeholder="http://example.com/api" id="input_baseUrl" name="baseUrl" type="text"/></div>' + | ||
'<div id="auth_container"></div>' + | ||
'<div class="input"><a id="explore" class="header__btn" href="#" data-sw-translate>Explore</a></div>' + | ||
'</form>'; | ||
const setup = (swaggerDoc, explorer) => { | ||
const html = fs.readFileSync(__dirname + '/indexTemplate.html'); | ||
var setup = function(swaggerDoc, explorer) { | ||
var html = fs.readFileSync(__dirname + '/indexTemplate.html'); | ||
try { | ||
@@ -19,13 +19,13 @@ fs.unlinkSync(__dirname + '/index.html'); | ||
} | ||
const htmlWithSwaggerReplaced = html.toString().replace('<% swaggerDoc %>', JSON.stringify(swaggerDoc)); | ||
const explorerString = explorer ? explorerHtml : ''; | ||
const indexHTML = htmlWithSwaggerReplaced.replace('<% explorerString %>', explorerString) | ||
return (req, res) => res.send(indexHTML); | ||
} | ||
var htmlWithSwaggerReplaced = html.toString().replace('<% swaggerDoc %>', JSON.stringify(swaggerDoc)); | ||
var explorerString = explorer ? explorerHtml : ''; | ||
var indexHTML = htmlWithSwaggerReplaced.replace('<% explorerString %>', explorerString) | ||
return function(req, res) { res.send(indexHTML) }; | ||
}; | ||
const serve = express.static(__dirname + '/static') | ||
var serve = express.static(__dirname + '/static') | ||
module.exports = { | ||
setup, | ||
serve | ||
}; | ||
setup: setup, | ||
serve: serve | ||
}; |
{ | ||
"name": "swagger-ui-express", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Swagger UI Express", | ||
@@ -16,20 +16,21 @@ "main": "./lib/index.js", | ||
"keywords": [ | ||
"swagger", | ||
"express", | ||
"ui", | ||
"json", | ||
"documentation" | ||
"swagger", | ||
"express", | ||
"ui", | ||
"json", | ||
"documentation" | ||
], | ||
"private": false, | ||
"engines": { | ||
"node": ">= 4.2.0" | ||
"node": ">= v0.10.32" | ||
}, | ||
"devDependencies": { | ||
"mocha": "2.2.5", | ||
"express": "4.12.2", | ||
"phantom": "2.1.21" | ||
}, | ||
"es6-shim": "0.35.2", | ||
"express": "4.12.2", | ||
"mocha": "2.2.5", | ||
"phantom": "2.1.21" | ||
}, | ||
"author": { | ||
"name": "Stephen Scott", | ||
"email": "scottie1984@gmail.com" | ||
"email": "scottie1984@gmail.com" | ||
}, | ||
@@ -46,2 +47,2 @@ "repository": { | ||
"homepage": "https://github.com/scottie1984/swagger-ui-express" | ||
} | ||
} |
@@ -49,3 +49,3 @@ # Swagger UI Express | ||
* Node v4.2 or above | ||
* Node v0.10.32 or above | ||
* Express 4 or above | ||
@@ -57,2 +57,2 @@ | ||
npm install | ||
npm test | ||
npm test |
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
3003062
35156
57
4