Skip to content

Mount Swagger docs endpoints - #924

Merged
ogazboiz merged 1 commit into
LabsCrypt:mainfrom
Obiajulu-gif:issue-859-swagger-docs
May 27, 2026
Merged

Mount Swagger docs endpoints#924
ogazboiz merged 1 commit into
LabsCrypt:mainfrom
Obiajulu-gif:issue-859-swagger-docs

Conversation

@Obiajulu-gif

Copy link
Copy Markdown
Contributor

This pull request enhances the Swagger/OpenAPI documentation support in the backend, making it easier to access API docs in development and production (when enabled), and adds robust testing for this functionality. The main changes include new logic for mounting and serving Swagger docs, improved environment-based access control, and comprehensive tests for these endpoints.

Swagger documentation improvements:

  • Added a new mountSwaggerDocs function in backend/src/config/swagger.ts to configure and serve Swagger UI and the raw OpenAPI JSON at /docs and /docs.json, with access controlled by environment variables (NODE_ENV and ENABLE_SWAGGER).
  • Updated the API documentation section in backend/README.md to reflect the new URLs and explain the environment-based gate for Swagger UI access.
  • Integrated Swagger doc mounting into the main app by calling mountSwaggerDocs(app) in backend/src/app.ts. [1] [2]

Testing enhancements:

  • Added a new test suite in backend/src/__tests__/swaggerDocs.test.ts to verify Swagger UI and JSON endpoints are correctly served or restricted based on environment settings.

Closes #859

@ogazboiz
ogazboiz merged commit 5e46684 into LabsCrypt:main May 27, 2026
3 of 6 checks passed
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.

[Backend] Mount Swagger UI at /docs to serve the existing OpenAPI spec

2 participants