api-to-readme
v1.0.1
Published
Script to insert REST API endpoints to README.md
Downloads
2
Maintainers
Readme
API To README
Script to insert REST API endpoints to README.md
:rocket: Getting Started
Install
npm install api-to-readme
Usage
/scripts/generateAPI.js
// ES5
const { makeReadme } = require('api-to-readme')
// Typescript
import { makeReadme, API } from 'api-to-readme'
const apis: API[]= [
{
name: "Search",
description: "Search for user",
endpoint: "/search/",
method: "GET",
queryString: [
{
type: "string",
name: "q",
description: "Search query",
required: true,
},
],
response: {
code: 200,
posts: [
{
name: "string",
},
{
name: "string",
},
],
},
},
]
makeReadme(apis, {
readmePath: path.join(__dirname, "README.md"),
startComment: "api-start",
endComment: "api-end",
})
Run
# run the script
node scripts/generateAPI.js
Before
/README.md
# My Awesome Project
...
## API Reference
<!-- api-start -->
<!-- api-end -->
...
After
/README.md
# My Awesome Project
...
## API Reference
<!-- api-start -->
### **Search**
Search for user
| Parameter | Type | Description |
| --------- | -------- | ------------------------- |
| `q` | `string` | **Required** Search query |
```http
GET /search/
```
- Response
```json
{
"code": 200,
"posts": [
{
"name": "string"
},
{
"name": "string"
}
]
}
```
<!-- api-end -->
...
:checkered_flag: Contribution
# Clone this project
$ git clone https://github.com/arpitBhalla/api-to-readme
# Access
$ cd api-to-readme
# Install dependencies
$ npm install
# Start contribution
:memo: License
This project is under license from MIT. For more details, see the LICENSE file.
Made with :heart: by Arpit Bhalla
Author
Arpit Bhalla
- Website: arpitbhalla.me
- GitHub: arpitBhalla
- LinkedIn: arpitbhalla
Back to top