An open API service indexing awesome lists of open source software.

https://github.com/arpitbhalla/api-to-readme

Script to insert REST API endpoints to README.md
https://github.com/arpitbhalla/api-to-readme

api arpitbhalla hacktoberfest readme rest-api scripts

Last synced: 5 months ago
JSON representation

Script to insert REST API endpoints to README.md

Awesome Lists containing this project

README

          

# API To README

Script to insert REST API endpoints to README.md

![npm](https://img.shields.io/npm/v/api-to-readme?style=flat-square) ![npm](https://img.shields.io/npm/dm/api-to-readme?style=flat-square) ![NPM](https://img.shields.io/npm/l/api-to-readme?style=flat-square) ![Snyk Vulnerabilities for npm package](https://img.shields.io/snyk/vulnerabilities/npm/api-to-readme?style=flat-square) ![Libraries.io dependency status for latest release](https://img.shields.io/librariesio/release/npm/api-to-readme?style=flat-square)

---

## :rocket: Getting Started

### Install

```bash
npm install api-to-readme
```

### Usage

```js
/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

```bash
# run the script
node scripts/generateAPI.js
```

### **Before**

```md
/README.md

# My Awesome Project

...

## API Reference

...
```

### **After**

````md
/README.md

# My Awesome Project

...

## API Reference

### **Search**

Search for user

| Parameter | Type | Description |
| --------- | -------- | ------------------------- |
| `q` | `string` | **Required** Search query |

```http
GET /search/
```

- Response

```json
{
"code": 200,
"posts": [
{
"name": "string"
},
{
"name": "string"
}
]
}
```

...
````

## :checkered_flag: Contribution

```bash
# 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](LICENSE.md) file.

Made with :heart: by Arpit Bhalla

## Author

**Arpit Bhalla**

- Website: [arpitbhalla.me](https://arpitbhalla.vercel.app/)
- GitHub: [arpitBhalla](https://github.com/arpitbhalla/)
- LinkedIn: [arpitbhalla](https://linkedin.com/in/arpitbhalla/)

 

Back to top