atr

api-to-readme

Script to insert REST API endpoints to README.md

Showing:

Popularity

Downloads/wk

908

GitHub Stars

7

Maintenance

Last Commit

19d ago

Contributors

0

Package

Dependencies

0

License

MIT

Type Definitions

Built-In

Tree-Shakeable

No?

Categories

Readme

API To README

Script to insert REST API endpoints to README.md

npm npm NPM Snyk Vulnerabilities for npm package Libraries.io dependency status for latest release


🚀 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 -->

...

🏁 Contribution

# Clone this project
$ git clone https://github.com/arpitBhalla/api-to-readme

# Access
$ cd api-to-readme

# Install dependencies
$ npm install

# Start contribution

📝 License

This project is under license from MIT. For more details, see the LICENSE file.

Made with ❤️ by Arpit Bhalla

Author

Arpit Bhalla

 

Back to top

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial