Skip to content

fix: redirect swagger fixed#1572

Open
joaoMiraya wants to merge 1 commit into
credebl:mainfrom
joaoMiraya:fix/swagger-route
Open

fix: redirect swagger fixed#1572
joaoMiraya wants to merge 1 commit into
credebl:mainfrom
joaoMiraya:fix/swagger-route

Conversation

@joaoMiraya

@joaoMiraya joaoMiraya commented Feb 25, 2026

Copy link
Copy Markdown

Redirect http://localhost:5000 -> http://localhost:5000/api when's development mode

Issue

Summary by CodeRabbit

  • New Features
    • Users can now be automatically redirected to API documentation from the main application endpoint.
    • Redirect behavior adapts based on the deployment environment.

Signed-off-by: joaoMiraya <joaomiraya01@gmail.com>
@coderabbitai

coderabbitai Bot commented Feb 25, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e516d40 and c94f7ca.

📒 Files selected for processing (1)
  • apps/api-gateway/src/app.controller.ts

📝 Walkthrough

Walkthrough

A new redirect route handler is added to the AppController that conditionally redirects requests to /api. The ConfigService dependency is injected and a Logger is instantiated. The constructor is updated to accept both AppService and ConfigService parameters.

Changes

Cohort / File(s) Summary
API Gateway Controller Enhancement
apps/api-gateway/src/app.controller.ts
Injects ConfigService and Logger into AppController. Adds redirectToSwagger() route handler that conditionally redirects to /api (status 301 in development, 200 otherwise). Updates imports and extends constructor signature to include ConfigService.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A redirect route hops into view,
ConfigService keeps config true,
Development swaggers with a 301 bounce,
While production stays calm—quite the clever announcement! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'fix: redirect swagger fixed' is vague and uses awkward phrasing ('fixed' twice), making it unclear whether the change fixes a redirect issue, adds a redirect feature, or addresses swagger configuration. Use a clearer, more specific title such as 'fix: add swagger redirect for development mode' or 'fix: redirect root path to /api in development' to accurately convey the change's purpose.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sonarqubecloud

Copy link
Copy Markdown

@RinkalBhojani

Copy link
Copy Markdown
Contributor

@joaoMiraya - Thanks for your contribution.

I have one suggestion.

Instead of limiting the Swagger UI redirect to development mode only, I think it would be better to make it configurable through some different flag in .env file. That way, users can decide which environments they want to expose the Swagger endpoint in.

For example, if someone wants to enable it in production for their own use case, they should be able to do so. This keeps the default behavior safe while giving users the flexibility to configure it based on their needs.

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