# swagger-doc

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

Latest version **0.3.0** (published 2015-08-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install swagger-doc
pnpm add swagger-doc
yarn add swagger-doc
bun add swagger-doc
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.0 |
| Published | 2015-08-23 |
| First published | 2012-05-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >0.6.0 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 23 |
| Author | Eirikur Nilsson |
| Maintainers | eirikurn |
| Keywords | swagger, rest, api, docs, express, restify |

## Links

- npm: https://www.npmjs.com/package/swagger-doc
- Repository: https://github.com/eirikurn/swagger-doc
- Issues: https://github.com/eirikurn/swagger-doc/issues
- npm.io page: https://npm.io/package/swagger-doc

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 0.3.0 (latest) — 2015-08-23
- 0.2.0 — 2013-03-16
- 0.1.1 — 2012-06-03
- 0.1.0 — 2012-05-28

## README

# swagger-doc

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

## Getting Started
Install the module with: `npm install swagger-doc`

## Example
```javascript
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");

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.
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](https://github.com/cowboy/grunt).

## Release History
_(Nothing yet)_

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

---
_Source: https://npm.io/package/swagger-doc · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
