Create the documentation of your Netlify functions automatically.
yarn add netlify-functions-api-docs
npm install netlify-functions-api-docs
Edit the file doc_config.js
with the basic information of your site or organization.
const netlifydoc = require('netlify-functions-api-docs/index');
const config = {
basedir: "functions",
info: {
sitename: "MY SITE / ORGANIZATION",
logourl: "MY LOGO URL",
sitedescription: "MY SITE DESCRIPTION"
}
}
netlifydoc.createDoc(config);
Create an index.doc.json
file inside each function folder.
project
β node_modules
β functions
| ββββfunction1
| β β index.js
| β β index.doc.json <-
| ...
β package.json
β doc_config.js
Each file must have the following structure:
{
"name": "ENDPOINT NAME",
"path": "/endpoint-url",
"method": "GET",
"description": "SOME DESCRIPTION"
}
To generate the documentation we simply execute yarn run createdoc
or npm run createdoc
.
Pull requests and π stars are always welcome. For major changes, please open an issue first to discuss what you would like to change.
Twitter @iamraul_net
Linkedin @iamraul