Skip to content
This repository has been archived by the owner on May 8, 2018. It is now read-only.
/ swagger-doc Public archive
forked from eirikurn/swagger-doc

Document your express/restify rest api and expose to swagger ui.

License

Notifications You must be signed in to change notification settings

TrackIF/swagger-doc

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

swagger-doc

Document your express/restify rest api and expose to swagger ui.

Getting Started

Install the module with: npm install swagger-doc

Example

var restify = require('restify'),
    swagger = require('swagger-doc'),
    server = restify.createServer();


// All configuration is optional. Only server is needed to add swagger routes.
swagger.configure(server, {
	discoveryUrl: "/resources.json",
	version:      "0.1",
	basePath:     "https://api.product.com"
});


// Create a new swagger resource at specified route.
docs = swagger.createResource("/payments");

// Documents an api, all options are same as in swagger.
docs.get("/payments/{id}", "Gets information about a specific payment", {
	notes: "The information is very sexy.",
	nickname: "getPayment",
	parameters: [
	  {name:"id", description: "Id of payment", required:true, dataType: "string", paramType: "path"}
	]
});

// Another resource
var docs = swagger.createResource("/account");

// Swagger-doc has express-like api.
docs.post('/account/authenticate', {
  summary: "Authenticates a user"
});

docs.get('/account/user', {
  summary: "Returns the logged in user"
});

docs.delete('/account/user', {
  summary: "Logs out the current user"
});

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using grunt.

Release History

(Nothing yet)

License

Copyright (c) 2012 Eirikur Nilsson
Licensed under the MIT license.

About

Document your express/restify rest api and expose to swagger ui.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%