diff --git a/example/app.js b/example/app.js index 80eeb8a7..9331cd5a 100644 --- a/example/app.js +++ b/example/app.js @@ -4,7 +4,6 @@ // Dependencies var express = require('express'); var bodyParser = require('body-parser'); -var swaggerTools = require('swagger-tools'); var routes = require('./routes'); var swaggerJSDoc = require('../'); @@ -42,20 +41,11 @@ var options = { var swaggerSpec = swaggerJSDoc(options); -// Swagger Tools Options -var swaggerToolsUIOptions = { - apiDocs: '/api-docs.json', - swaggerUi: '/docs', -}; - - -// Initialize the Swagger middleware -swaggerTools.initializeMiddleware(swaggerSpec, - function(middleware) { - // Serve the Swagger documents and Swagger UI - app.use(middleware.swaggerUi(swaggerToolsUIOptions)); - } -); +// Serve swagger docs the way you like (Recommendation: swagger-tools) +app.get('/api-docs.json', function(req, res) { + res.setHeader('Content-Type', 'application/json'); + res.send(swaggerSpec); +}); // Set up the routes diff --git a/example/routes.js b/example/routes.js index 21c0c060..53c74ae1 100644 --- a/example/routes.js +++ b/example/routes.js @@ -1,18 +1,6 @@ 'use strict'; -// Handler for the Homepage -function rootHandler(req, res) { - res.send('Hello World!'); -} - - -// Handler for Login -function loginHandler(req, res) { - res.json(req.body); -} - - // Sets up the routes. module.exports.setup = function(app) { @@ -26,7 +14,9 @@ module.exports.setup = function(app) { * 200: * description: hello world */ - app.get('/', rootHandler); + app.get('/', function(req, res) { + res.send('Hello World!'); + }); /** @@ -51,5 +41,7 @@ module.exports.setup = function(app) { * 200: * description: login */ - app.post('/login', loginHandler); + app.post('/login', function(req, res) { + res.json(req.body); + }); }; \ No newline at end of file diff --git a/external.jsdoc b/external.jsdoc index 9618f1ca..f8a5d5e8 100644 --- a/external.jsdoc +++ b/external.jsdoc @@ -15,9 +15,9 @@ */ /** - * Various tools for using and integrating with Swagger. - * @external module:swagger-tools + * Swagger JSON/YAML parser and validator for Node and browsers + * @external module:swagger-parser * @global - * @see https://www.npmjs.com/package/swagger-tools + * @see https://www.npmjs.com/package/swagger-parser * @license MIT */ \ No newline at end of file diff --git a/package.json b/package.json index 64e78dfd..045d16b8 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,6 @@ "mocha": "^2.2.5", "mocha-jscs": "^1.1.0", "mocha-jshint": "^2.2.3", - "supertest": "^1.0.1", - "swagger-tools": "^0.8.7" + "supertest": "^1.0.1" } }