Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aungmyokyaw/redoc-express
Express Middleware for OpenAPI/Swagger-generated API Reference Documentation
https://github.com/aungmyokyaw/redoc-express
open-api-express redoc redoc-express swagger swagger-express
Last synced: 1 day ago
JSON representation
Express Middleware for OpenAPI/Swagger-generated API Reference Documentation
- Host: GitHub
- URL: https://github.com/aungmyokyaw/redoc-express
- Owner: AungMyoKyaw
- License: mit
- Created: 2019-11-02T10:26:30.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-05-05T17:49:18.000Z (over 1 year ago)
- Last Synced: 2024-10-30T02:55:55.183Z (21 days ago)
- Topics: open-api-express, redoc, redoc-express, swagger, swagger-express
- Language: TypeScript
- Homepage: http://npm.im/redoc-express
- Size: 91.8 KB
- Stars: 17
- Watchers: 2
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# [redoc-express][redoc-express]
> Express Middleware for OpenAPI/Swagger-generated API Reference Documentation
[![code style: prettier][prettier]][prettier-url]
[![npm][npm-download]][npm-dl-url]
[![contributions welcome][contri]][contri-url]
[![License: MIT][license]][license-url]## Demo
- [Live Demo][live-demo-url]
## Install
```shell
npm install redoc-express
```## Usage
```javascript
const express = require('express');
const redoc = require('redoc-express');const app = express();
const port = 3000;// serve your swagger.json file
app.get('/docs/swagger.json', (req, res) => {
res.sendFile('swagger.json', { root: '.' });
});// define title and specUrl location
// serve redoc
app.get(
'/docs',
redoc({
title: 'API Docs',
specUrl: '/docs/swagger.json',
nonce: '', // <= it is optional,we can omit this key and value
// we are now start supporting the redocOptions object
// you can omit the options object if you don't need it
// https://redocly.com/docs/api-reference-docs/configuration/functionality/
redocOptions: {
theme: {
colors: {
primary: {
main: '#6EC5AB'
}
},
typography: {
fontFamily: `"museo-sans", 'Helvetica Neue', Helvetica, Arial, sans-serif`,
fontSize: '15px',
lineHeight: '1.5',
code: {
code: '#87E8C7',
backgroundColor: '#4D4D4E'
}
},
menu: {
backgroundColor: '#ffffff'
}
}
}
})
);app.listen(port, () => console.log(`Example app listening on port ${port}!`));
```## Development
### Install Dependencies
```shell
npm i
```### Run Test
```shell
npm t
```## Check ReDoc Project for more INFO
- [redoc][redoc-url]
## License
MIT © [Aung Myo Kyaw](https://github.com/AungMyoKyaw)
[redoc-express]: https://github.com/AungMyoKyaw/redoc-express
[contri]: https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat-square
[contri-url]: https://github.com/AungMyoKyaw/redoc-express/issues
[npm-download]: https://img.shields.io/npm/dt/redoc-express.svg?style=flat-square
[npm-dl-url]: https://www.npmjs.com/package/redoc-express
[license]: https://img.shields.io/badge/License-MIT-brightgreen.svg?style=flat-square
[license-url]: https://opensource.org/licenses/MIT
[prettier]: https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square
[prettier-url]: https://github.com/prettier/prettier
[redoc-url]: https://github.com/Redocly/redoc
[live-demo-url]: http://redocly.github.io/redoc/