Insomnia is a powerful REST client that can help you test and debug your APIs. But did you know that you can also use it to generate API documentation? In this tutorial, we'll show you how to do just that.
1. Create your Insomnia Project
First, you'll need to create an Insomnia project. If you're not familiar with Insomnia, you can download it for free from the official website.
2. Export your project in JSON format
Once you've created your project, you'll need to export it in JSON format. To do this, go to File
> Export Data
> Insomnia v4 (JSON)
.
3. Generate the documentation
Before you can generate the documentation, you'll need to install Node.js on your system.
Once you have Node.js installed, open your command prompt or terminal and navigate to the folder where your JSON file is located.
Execute the following command:
npx insomnia-documenter --config <name of the file>.json --output <name of the documentation>.json
4. See your documentation
Local Documentation
If you want to see your documentation on your local machine, you'll need to run a server. To do this, navigate to the folder where your documentation was generated and execute the following command:
npx serve
Online Documentation
If you want to share your documentation on the internet, you'll need to upload it to a deploy website. We recommend using Netlify because it's easy and fast.
If this article was helpful, please give a ❤️ to make more content like this.
Top comments (2)
very helpful thanks
how do I edit the example response on the documentation to fit with what I have on the insomnia app