This action automatically scans for express APIs in your codebase and generates a documentation website
To add this action to your workflow simply modify your workflows main.yml file.
# This is a basic workflow to help you get started with Express AutoDocs Action
name: Express AutoDocs.
# This specifies when the action should occur
on:
push:
branches: [master]
jobs:
generate_docs_job:
runs-on: ubuntu-latest
name: Generating Docs
steps:
# this step checks out the master branch of your repo using checkout action.
- name: Checks out the repository
id: checksout-repository
uses: actions/checkout@v2
with:
repository: ""
# this step generates the docs
- name: Generating Docs.
id: reading-file
uses: Pika1998/express-autodocs@v0.0.1
# Use the output from the `hello` step
- name: Get the output time
run: echo "The time was ${{ steps.reading-file.outputs.time }}"
Following are the parameters which you can modify to make this action suitable for your codebase.
Parameters | Description | Default Value |
---|---|---|
appName | The name of the app variable | app |
routerName | The name of the router variable | router |
docsTitle | The title of the documentation page | Documentation |
server-filepath | The path of the base index file where APIs are defined | server.js |
outputFormat | The format in which assets are deployed markdown - To generate MD files standard - To generate HTML & CSS Files |
standard |
outputBranch | The branch in which the generated docs are deployed | express-autodocs |
You can easily add description to your APIs using JSON in comments in the following way
Adding API descriptions
/*
{
"description":"Checks for token and gets the logged in user",
"inputs":{
"x-auth-token":"The JWT Token in header"
},
"label":"Public",
"outputs":{
"user":"The user object stored in database",
}
}
*/
router.get("/user", auth, (req, res) => {
User.findById(req.user.id)
.select("-password")
.then((user) => {
res.json(user);
});
});
Check the CHANGELOG.md to view the changes done to this action over time
Contributions to this action are most welcomed. please check the Contributions Guide for more details.