# swagger-restify-express

> This module will automagically wire your restify and express paths to swagger framework.

Latest version **0.2.1** (published 2014-06-02) · Apache license · 0 weekly downloads

## Install

```sh
npm install swagger-restify-express
pnpm add swagger-restify-express
yarn add swagger-restify-express
bun add swagger-restify-express
```

## 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.2.1 |
| Published | 2014-06-02 |
| First published | 2014-05-06 |
| Weekly downloads | 0 |
| License | Apache |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 (+18 in 3 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Manoj Kumar MC |
| Maintainers | manojkumarmc |
| Keywords | swagger, restify, express |

## Links

- npm: https://www.npmjs.com/package/swagger-restify-express
- Repository: https://github.com/manojkumarmc/swagger-restify-express
- Issues: https://github.com/manojkumarmc/swagger-restify-express/issues
- npm.io page: https://npm.io/package/swagger-restify-express

## Dependencies (4)

- [express](https://npm.io/package/express.md) ~4.1.1
- [restify](https://npm.io/package/restify.md) ~2.7.0
- [swagger-ui](https://npm.io/package/swagger-ui.md) ~2.0.16
- [swagger-doc](https://npm.io/package/swagger-doc.md) ~0.2.0

## Recent versions

- 0.2.1 (latest) — 2014-06-02
- 0.2.0 — 2014-06-02
- 0.1.4 — 2014-05-30
- 0.1.3 — 2014-05-30
- 0.1.2 — 2014-05-15
- 0.1.1 — 2014-05-15
- 0.1.0 — 2014-05-10
- 0.0.11 — 2014-05-09
- 0.0.10 — 2014-05-09
- 0.0.9 — 2014-05-09
- 0.0.8 — 2014-05-07
- 0.0.7 — 2014-05-06
- 0.0.6 — 2014-05-06
- 0.0.5 — 2014-05-06
- 0.0.4 — 2014-05-06
- … 3 more at https://npm.io/package/swagger-restify-express/versions

## README

swagger-restify-express
=========
<br>
This package will automagically wire your restify and express paths to swagger framework.
<br><br>

#### Make sure that your REST library is "restify"
```console
npm install restify
var restify =  require('restify')
```
<br>

#### Include swagger-restify-express in your project.
```console
sre = require('swagger-restify-express')
```
<br>

#### Have the restify server running
```console
var server = restify.createServer({
  name:"My REST server"
});

server.pre(restify.pre.userAgentConnection());
server.use(restify.bodyParser({ mapParams: false }));

server.get('/xxx/:id', function(req, res) {
  res.send('hello from my REST server ' + req.params.name);
});

server.get('/xxx/:id/getit/:here', function(req, res) {
  res.send('hello from my REST server ' + req.params.name);
});

server.post('/offload', someClass.offload);

sre.init(server, {
		  resourceName : 'swag',
		  server : 'restify', // or express
		  httpMethods : ['GET', 'POST'],
		  basePath : 'https://yourdomain.com',
		  ignorePaths : {
		  	      GET : ['path1', 'path2'],
			      POST : ['path1']
		  }
		}
       )

server.listen(3000, function() {
  console.log('%s listening at %s', server.name, server.url);
});
```
<br>
#### Make sure that you add the line, so that the auto wiring is done.
```console
sre.init(server, {
		  resourceName : 'swag',
		  server : 'restify', // or express
		  httpMethods : ['GET', 'POST'],
		  basePath : 'https://yourdomain.com',  // MANDATORY
		  ignorePaths : {
		  	      GET : ['path1', 'path2'],
			      POST : ['path1']
		  }
		}
       )
```

<br>
#### Crank up your server
```sh
node app.js
```
<br>
#### Open up your browser
```sh
http://localhost:3000/api-docs.html
```


![alt tag](https://raw.githubusercontent.com/manojkumarmc/swagger-restify-express/master/swagger-ui.jpg)

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