Document your express/restify rest api and expose to swagger ui.
Latest commit e2d7905 Aug 23, 2015 @eirikurn Release 0.3.0


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

Getting Started

Install the module with: npm install swagger-doc


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:     ""

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

docs.models.Payment = {...};

// 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", {
    models: {
        Account: {...}

// Swagger-doc has express-like api.'/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"


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)


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