# restify-swagger-jsdoc-openapi3

> Create Swagger documentation page based on jsdoc

Latest version **1.0.0** (published 2019-03-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install restify-swagger-jsdoc-openapi3
pnpm add restify-swagger-jsdoc-openapi3
yarn add restify-swagger-jsdoc-openapi3
bun add restify-swagger-jsdoc-openapi3
```

## Health

**Score 35/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2019-03-26 |
| First published | 2019-03-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 14.7 KB |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 14 |
| Author | Rémy Jeancolas |
| Maintainers | fer.pileggi |
| Keywords | restify, swagger, jsdoc, api |

## Links

- npm: https://www.npmjs.com/package/restify-swagger-jsdoc-openapi3
- Repository: https://github.com/RemyJeancolas/restify-swagger-jsdoc
- Homepage: https://github.com/RemyJeancolas/restify-swagger-jsdoc#readme
- Issues: https://github.com/RemyJeancolas/restify-swagger-jsdoc/issues
- npm.io page: https://npm.io/package/restify-swagger-jsdoc-openapi3

## Dependencies (4)

- [mime-types](https://npm.io/package/mime-types.md) ^2.1.21
- [swagger-jsdoc](https://npm.io/package/swagger-jsdoc.md) ^3.2.6
- [restify-errors](https://npm.io/package/restify-errors.md) ^6.1.1
- [swagger-ui-dist](https://npm.io/package/swagger-ui-dist.md) ^3.18.2

## Recent versions

- 1.0.0 (latest) — 2019-03-26

## README

# restify-swagger-jsdoc
Create Swagger documentation page based on jsdoc

[![Build Status](https://travis-ci.org/RemyJeancolas/restify-swagger-jsdoc.svg?branch=master)](https://travis-ci.org/RemyJeancolas/restify-swagger-jsdoc)
[![Coverage Status](https://coveralls.io/repos/github/RemyJeancolas/restify-swagger-jsdoc/badge.svg?branch=master)](https://coveralls.io/github/RemyJeancolas/restify-swagger-jsdoc?branch=master)
[![npm Version](https://img.shields.io/npm/v/restify-swagger-jsdoc.svg)](https://www.npmjs.com/package/restify-swagger-jsdoc)
[![npm Downloads](https://img.shields.io/npm/dm/restify-swagger-jsdoc.svg)](https://www.npmjs.com/package/restify-swagger-jsdoc)
[![Dependency Status](https://gemnasium.com/badges/github.com/RemyJeancolas/restify-swagger-jsdoc.svg)](https://gemnasium.com/github.com/RemyJeancolas/restify-swagger-jsdoc)

## Installation

### :warning: Check your restify version

**If you use a restify version prior to v7, you must use the following command:**
```bash
npm install restify-swagger-jsdoc@^1 --production
```
Else you can use the following command:
```bash
npm install restify-swagger-jsdoc --production
```

## Initialization

To initialize the swagger JSDoc page, simply add this lines to the file that loads your restify server :

```javascript
var restifySwaggerJsdoc = require('restify-swagger-jsdoc');
restifySwaggerJsdoc.createSwaggerPage({
    title: 'API documentation', // Page title (required)
    version: '1.0.0', // Server version (required)
    server: server, // Restify server instance created with restify.createServer() (required)
    path: '/docs/swagger', // Public url where the swagger page will be available (required)
    description: 'My great app', // A short description of the application. (default: '')
    tags: [{ // A list of tags used by the specification with additional metadata (default: [])
        name: 'Tag name',
        description: 'Tag description'
    }],
    host: 'google.com', // The host (name or ip) serving the API. This MUST be the host only and does not include the scheme nor sub-paths.
    schemes: [], // The transfer protocol of the API. Values MUST be from the list: "http", "https", "ws", "wss". (default: [])
    apis: [ `${__dirname}/controllers/*.js` ], // Path to the API docs (default: [])
    definitions: {myObject: require('api/myObject.json')}, // External definitions to add to swagger (default: [])
    routePrefix: 'prefix', // prefix to add for all routes (default: '')
    forceSecure: false // force swagger-ui to use https protocol to load JSON file (default: false)
});
```

With these settings, assuming that your server listens on port 80, the Swagger documentation page will be available at [http://localhost/docs/swagger](http://localhost/docs/swagger).  
The swagger.json file is available at [http://localhost/docs/swagger/swagger.json](http://localhost/docs/swagger/swagger.json).

## How to document the API

This module is based on [swagger-jsdoc](https://www.npmjs.com/package/swagger-jsdoc), so you can refer to this module's documentation to document your API.

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