ls-doc-maker-axios-middleware

Axios Middleware To Generate a LS Doc Maker Json Automatically

Usage no npm install needed!

<script type="module">
  import lsDocMakerAxiosMiddleware from 'https://cdn.skypack.dev/ls-doc-maker-axios-middleware';
</script>

README

Ls Doc Maker Axios Middleware (UNDER CONSTRUCTION)

Codacy Badge npm version

A axios middleware to automatticaly create Ls Doc Maker json from axios requests

Why?

I create this middleware based on my needs. I just wanted a easy way to build a Ls Doc Maker documetation for another developer so he could follow the documentation to build something for me.

How to?

// First thing is to import all stuff
const axios = require('axios');
const { LsDocMakerAxiosMiddlewareBuildOptions, attatchLsDocMaker, buildLsDocMaker } = require('ls-doc-maker-axios-middleware')

// Then you have to create a axios instance
const myAxiosInstance = axios.create({ ... })

// Then you have to wrap the axios instance with our attach method
let myLsDocMiddlewareInstance = attatchLsDocMaker(myAxiosInstance)

// Now every axios request that you do will generate some log that you will have to save it to json files like that
myLsDocMiddlewareInstance.toJsonFile('The path for your json files')

// But this is not the final documentation yet, first, you have to build the docs like this
const options = new LsDocMakerAxiosMiddlewareBuildOptions(
    ['Array of your generated json paths (same path passed before in toJsonFile method)'],
    'Ouput path for your final doc',
    'Title of your documentation',
    'url-of-your-docs.com',
    'Some observation about your docs',
    true // true or false for clear (delete) or not all json files generated with toJsonFile method after build the final doc
)

// Then build with the options
buildLsDocMaker(options)

That's it, now you can get your final json file and use in the my Ls Doc Maker tool for change whatever you want before publish it

Contribute

Just open Pull Requests, issues or just mail me: leandro.simoes@outlook.com