Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
scottie1984 committed Nov 30, 2021
1 parent d07439b commit fe789d8
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,26 @@ app.use('/api-docs-one', swaggerUi.serveFiles(swaggerDocumentOne, options), swag
app.use('/api-docs-two', swaggerUi.serveFiles(swaggerDocumentTwo, options), swaggerUi.setup(swaggerDocumentTwo));
```

### Link to Swagger document

To render a link to the swagger document for downloading within the swagger ui - then serve the swagger doc as an endpoint and use the url option to point to it:

```javascript
const express = require('express');
const app = express();
const swaggerUi = require('swagger-ui-express');
const swaggerDocument = require('./swagger.json');

var options = {
swaggerOptions: {
url: "/api-docs/swagger.json",
},
}

app.use('/api-docs', swaggerUi.serveFiles(null, options), swaggerUi.setup(null, options));
app.get("/api-docs/swagger.json", (req, res) => res.json(swaggerDocument));
```


## Requirements

Expand Down

0 comments on commit fe789d8

Please sign in to comment.