Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

insomnia-documenter

jozsefsallai2.6kMIT0.5.5

API documentation generator tool for Insomnia.

insomnia, API, docs, documentation, generator

readme

Insomnia Documenter

Like Postman Documenter but for Insomnia! With this tool you can generate beautiful API documentation pages using your Insomnia export file.

Demo: https://jozsefsallai.github.io/insomnia-documenter
Tutorial and demo video: https://www.youtube.com/watch?v=pq2u3FqVVy8

Table of Contents

Requirements

  • Node.js (8.x or higher is recommended)
  • An exported Insomnia workspace JSON (v4)

Getting Started

Insomnia Documenter offers a CLI tool to make it super easy to set up a documentation page. You can use it in two ways.

Using npx

npx insomnia-documenter --config /path/to/insomnia/config.json

By installing the package globally

npm i -g insomnia-documenter
insomnia-documenter --config /path/to/insomnia/config.json

Options

Options:
  -c, --config <location>  Location of the exported Insomnia JSON config.
  -l, --logo <location>    Project logo location (48x48px PNG).
  -f, --favicon <location>    Project favicon location (ICO).
  -o, --output <location>  Where to save the file (defaults to current working directory).
  -h, --help               output usage information

Using a GitHub release

Alternatively, you can start using Insomnia Documenter by downloading a release archive from GitHub and adding your insomnia.json export file to the root directory of your site.

Updating the API

Updating the API is super simple! Since Insomnia Documenter is a plug-and-play web app, you can just replace your insomnia.json with your new exported JSON file. Just make sure it's called insomnia.json.

The same actually applies to the logo (logo.png) e favicon (favicon.ico) as well .

Custom Root Paths

Maybe you want to document multiple APIs on the same domain? Perhaps you want to host your documentation page on GitHub pages? In this (any many other cases), you will need to specify what the root path is. To do this, you have to open index.html and replace the following line:

<div id="app"></div>

with something like this:

<div id="app" data-root="/path/to/docs"></div>

In this case, the app will pick up the insomnia.json file from the /path/to/docs directory. This gives you more flexibility over how you want to maintain your documentation page (for example, you can store the export file somewhere other than the root directory of the webpage). You should NOT put a trailing slash in the data-root property.

Please note that setting this attribute will not affect the favicon and the logo of the page. They will still be loaded from the same directory where index.html is.

Running the Page Locally

Opening the index.html file will fail to load in 99.9% of cases because that's just how fetch works. To preview the page locally, you might want to use a tool such as zeit/serve:

npx serve

The page will be available at http://localhost:5000.

Insomnia Plugin

devhammed has made an awesome Insomnia Plugin that allows you to generate a documentation page directly from Insomnia's interface. Get The Plugin (npm - github)

Changelog

Please see the Changelog document.

Contribution

The CLI tool is a commander applet, while the frontend itself is a Svelte app. This project is still in beta, which means it has bugs and can be improved here and there. Contribution is most welcome :)

Clone the repository:

git clone git@github.com:jozsefsallai/insomnia-documenter.git
cd insomnia-documenter

Install the dependencies:

npm install

Copy the demo Insomnia export file:

cp docs/insomnia.json public/insomnia.json

Run a development build with hot reload:

npm run dev

Create a production build:

npm run build

Linting:

npm run lint

Testing:

npm run test

License

MIT.

Note: this project is not affiliated with Kong and/or Insomnia.

Insomnia Documenter for enterprise

Available as part of the Tidelift Subscription

The maintainers of Insomnia Documenter and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. Learn more.

changelog

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

0.5.1 - 2021-05-21

Changed

  • upgraded some dependencies (@devhammed)

Fixed

  • body parser failing on invalid JSON

0.5.0 - 2021-05-14

Changed

  • example response format (@devhammed)

Fixed

  • highlight.js not working
  • env vars with underscore format (@devhammed)

0.4.4 - 2020-12-06

Fixed

  • Escaping in Python generator (thanks to @Psychokiller1888)
  • Escaping in curl generator (thanks to @Psychokiller1888)
  • Handle empty body values (thanks to @Psychokiller1888)
  • Handle empty header values (thanks to @Psychokiller1888)

Changed

  • Bumped highlight.js to 10.4.1

0.4.3 - 2020-10-05

Added

  • Table of Contents in the README
  • Notice about the Insomnia Plugin by @devhammed

Changed

  • UI/UX: Highlight variables and implement example toggle button (thanks @macjuul)

0.4.1 - 2020-08-09

Fixed

  • Rendering error when the example response is empty or null.

0.4.0 - 2020-06-30

Changed

  • Node.js example uses now fetch too
  • You can now specify multiple example responses with status code support

Fixed

  • Basic HTTP auth header generation (@michaelbaudino)

0.3.4 - 2020-05-30

Changed

  • Use short options in curl (@ZeProf2Code)
  • Updated dependencies

Fixed

  • Horizontal scrolling in code example

0.3.3 - 2020-04-06

Changed

  • Upgraded dependencies to resolve security vulnerabilities

Fixed

  • applyEnv regex error (@dingyaguang117)
  • Request order (@dingyaguang117)
  • applyEnv not replacing in every field (@aravindps)

0.3.2 - 2020-01-09

Added

  • Tutorial and demo video in the README
  • Security notice
  • Notice about enterprise support through Tidelift in the README

Changed

  • Upgraded devdependencies

Fixed

  • Logo not showing up when the documenter is not at root-level

0.3.1 - 2020-01-04

Added

  • Support for descriptions in headers, body, and parameters

0.3.0 - 2019-12-16

Added

  • Experimental support for example responses
  • Markdown table support (thanks to @motaghifar)

Fixed

  • Check if URL exists before trying to retrieve cookies (thanks to @farzeni)

0.2.1 - 2019-10-06

Added

  • Insomnia Documenter logo
  • Info about running the page locally in the README

Changed

  • Updated programming language dropdown
  • Switched to FontAwesome v4.7.0
  • Improved performance of sidebar folder opening

Fixed

  • Overflowing text breaking the entire layout

0.2.0 - 2019-09-20

Added

  • Run-in-Insomnia button (#1).
  • data-root property for <div id="root"> to change the location from which the Insomnia configuration will be loaded.
  • Error page if the config file cannot be loaded.
  • Changelog!

Changed

  • Removed forward slashes from static asset declarations in the HTML file (making it even more portable).
  • Header is less cluttery now.

0.1.5 - 2019-09-19

First public version.