JSPM

  • Created
  • Published
  • Downloads 321
  • Score
    100M100P100Q90212F
  • License MIT

Get your RESTful API up-and-running FAST! Fully-functional mocks without writing any code. And your real implementation isn't much harder.

Package Exports

  • swagger-server
  • swagger-server/lib/helpers/util

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (swagger-server) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Swagger-Server

Get your RESTful API up-and-running FAST!

Fully-functional mocks without writing any code. And your real implementation isn't much harder.

Features

  • Don't waste time writing boilerplate code - Swagger-Server automatically and intelligently mocks your API in real time as you write the spec. So you can instantly interact with your API and get valid responses back without writing any code.

  • Simple extensibility via Express.js - Suppliment Swagger-Server's mocks with your own custom logic, or replace the mocks entirely with your real API implementation. It's as easy as function(req, res, next)

  • Code however you want - Swagger-Server doesn't dictate your folder structure, file names, class/function naming conventions, or anything else.

  • Use your favorite code editor - Edit your Swagger spec in your favorite code editor. Swagger-Server will detect your changes and reload the file without missing a beat.

  • Get the whole suite! - Swagger-Server is just one part of Swagger-Suite, which is an end-to-end solution for defining, testing, running, and documenting your API.

Supported Swagger Versions

Installation

npm install swagger-server

That's all there is to it!

Running the samples

Swagger-Server comes with two sample apps: the ubiquitous "Swagger Petstore" is a simple example, and the "User Manager" demonstrates more advanced concepts. To run the petstore sample, just cd into the node_modules/swagger-server folder and run the following command:

cd node_modules/swagger-server
npm run petstore

Or, on Windows:

cd node_modules\swagger-server
npm run petstore-windows

Similarly, to run the "User Manager" sample insead, run:

cd node_modules/swagger-server
npm run users

Or, on Windows:

cd node_modules\swagger-server
npm run users-windows

Note: All of the above commands run the sample apps in DEBUG mode, which produces a lot of output in the console window.

Walkthrough

TODO

Contributing

I welcome any contributions, enhancements, and bug-fixes. File an issue on GitHub and submit a pull request. Use JSHint to make sure your code passes muster. (see .jshintrc).

Here are some things currently on the to-do list:

  • Unit tests - Need lots of 'em! Planning to use Mocha and Chai

  • Response validation - Currently, the mocks always adhere to the response schema defined in the Swagger spec, but if mocks are disabled (or bypassed via custom middleware), then all bets are off. It would be cool to add logic that intercepts res.send() and validates the response against the schema.

  • Better XML Support - My main focus has been on consuming/producing JSON, but Swagger-Server also supports consuming/producing XML. The XML functionality isn't as nicely polished as the JSON functionality yet though.

License

Swagger-Server is 100% free and open-source, under the MIT license. Use it however you want.