Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add and serve apiDoc documentation (for Tags) #70

Closed
xvjg opened this issue Mar 29, 2020 · 5 comments · Fixed by #74
Closed

Add and serve apiDoc documentation (for Tags) #70

xvjg opened this issue Mar 29, 2020 · 5 comments · Fixed by #74
Assignees
Labels
backend Related to backend code

Comments

@xvjg
Copy link
Contributor

xvjg commented Mar 29, 2020

Github: apiDoc

  • Add a package.json script docs which will generate the documentation into a folder, docs/
  • Serve the docs in express at route /api/docs
  • Document Tag route first, then we can decide how to document the whole project.

Documentation can include the following annotations:

  • @api for method, route, and 1 line description
  • @apiName for naming a route (GetTagList, GetTagBySlug)
  • @apiDescription, if required, for special routes or special notes.
  • @apiGroup for each resource (Tag)
  • @apiParam for the fields which can be passed in body or filter.
  • @apiPermission, first use @apiDefine in auth middleware to define the user permission model, then use that in authRequired routes.
  • @apiSuccessto define the fields in response document.

Avoid @apiError and @apiHeader for now.

@xvjg xvjg added the backend Related to backend code label Mar 29, 2020
@xvjg xvjg assigned siddinc and YJDoc2 and unassigned siddinc Mar 29, 2020
@YJDoc2
Copy link
Collaborator

YJDoc2 commented Mar 30, 2020

Api Doc generates a handlebars template which is supposed to be dynamically filled in at client side by script tag functions, but they are blocked by CSP policies of browsers.That's why we cannot directly serve the Docs generated by apidoc from express.Should we try to change to another doc generating library?

@xvjg
Copy link
Contributor Author

xvjg commented Mar 30, 2020

apidoc generates HTML/CSS/JS tho, not handlebars

@YJDoc2
Copy link
Collaborator

YJDoc2 commented Mar 30, 2020

The issue was with helmet middleware CSP used,fixed it.

@YJDoc2
Copy link
Collaborator

YJDoc2 commented Mar 30, 2020

Complete Page

Screenshot_2020-03-30 Docmentation of routes

NOTE : The side-bar, in actual page is sticky, and stays always on side for all time

Page as visible in window :
Screenshot_2020-03-30 Docmentation of routes(1)

@YJDoc2
Copy link
Collaborator

YJDoc2 commented Mar 30, 2020

Also added jsDoc documentation for documenting backend code(currently Tags only).

Documentation :
Screenshot_2020-03-30 JSDoc Namespace TagSchema

It can also show the files being documented :
Screenshot_2020-03-30 JSDoc Source tag js

@xvjg xvjg linked a pull request Mar 30, 2020 that will close this issue
@siddinc siddinc closed this as completed Apr 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Related to backend code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants