Skip to content

Documentation for routes functions#77

Open
joeljoby02 wants to merge 8 commits into
mainfrom
controller-jsdoc
Open

Documentation for routes functions#77
joeljoby02 wants to merge 8 commits into
mainfrom
controller-jsdoc

Conversation

@joeljoby02
Copy link
Copy Markdown
Collaborator

@joeljoby02 joeljoby02 commented Apr 23, 2026

Refactor route handler documentation

Remove async wrapper functions and add direct JSDoc comments to route definitions for cleaner documentation without middleware conflicts.

Changes

  • routes/create.js: Removed handleCreate() wrapper, added JSDoc above router.route('/') documenting POST /v1/api/create endpoint, JWT auth requirement, request body parameters, and response format
  • routes/delete.js: Removed handleDelete() wrapper, added JSDoc documenting DELETE endpoints (both root and :_id paths), auth requirement, optional path parameter, and response format
  • routes/query.js: Removed handleQuery() and handleQueryHead() wrappers, added JSDoc documenting POST and HEAD /v1/api/query endpoints, public access (no auth), query body parameters, and response format
  • routes/id.js: Removed handleId() and handleIdHead() wrappers, added JSDoc documenting GET and HEAD /v1/id/:_id endpoints, public access (no auth), path parameters, and response format
  • routes/release.js: Removed handleRelease() wrapper, added JSDoc documenting PATCH /v1/api/release/:_id endpoint, JWT auth requirement, path parameter, and response format
  • routes/search.js: Removed handleSearchAsWords() and handleSearchAsPhrase() wrappers, added JSDoc for both POST /v1/api/search and POST /v1/api/search/phrase endpoints, public access (no auth), query parameters, and response format

Rationale

  • Eliminates async wrapper functions that were creating middleware issues and causing rate limiting/CSRF errors
  • Maintains clear documentation of endpoint behavior directly at route definition
  • Reduces code duplication while preserving all endpoint documentation

Comment thread routes/create.js Fixed
Comment thread routes/delete.js Fixed
Comment thread routes/delete.js Fixed
Comment thread routes/id.js Fixed
Comment thread routes/id.js Fixed
Comment thread routes/query.js Fixed
Comment thread routes/query.js Fixed
Comment thread routes/release.js Fixed
Comment thread routes/search.js Fixed
Comment thread routes/search.js Fixed
Comment thread routes/id.js Fixed
Comment thread routes/id.js Fixed
Comment thread routes/query.js Fixed
Comment thread routes/search.js Fixed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants