-
Notifications
You must be signed in to change notification settings - Fork 32
Add api
to endpoints
#1309
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 api
to endpoints
#1309
Conversation
""" WalkthroughThe changes update the API endpoint structure by adding an Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Axios
participant Server
participant ExpressRoutes
Client->>Axios: Make HTTP request (base URL includes /api)
Axios->>Server: Send request to ${ENV_VARs.URL}/api/...
Server->>ExpressRoutes: Route request under /api/*
ExpressRoutes-->>Server: Handle and respond
Server-->>Axios: Send response
Axios-->>Client: Return response
Assessment against linked issues
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
Clients/src/infrastructure/api/customAxios.ts (1)
30-30
: Update documentation comment and sanitizebaseURL
constructionThe JSDoc above still refers to
REACT_APP_BASE_URL
(instead ofVITE_APP_API_BASE_URL
) and omits the/api
prefix. Also, trimming any trailing slash fromENV_VARs.URL
will prevent accidental double slashes (//api
) if the env var ends with/
.-baseURL: `${ENV_VARs.URL}/api`, +baseURL: `${ENV_VARs.URL.replace(/\/$/, "")}/api`,Servers/index.ts (1)
74-95
:❓ Verification inconclusive
Ensure Swagger docs and external references align with
/api
prefixAll Express routes have been moved under
/api
, which is correct. Please also:
- Update the
servers
section inswagger.yaml
to include/api
in the base path.- Confirm any health-check or monitoring endpoints now target
/api/*
.- Adjust client-side or CI tests that previously hit root-level routes.
Run this script to verify the
servers
section inswagger.yaml
:
🏁 Script executed:
#!/bin/bash # Locate swagger.yaml and display server URLs for inspection swagger_file=$(fd --max-depth 1 swagger.yaml | head -n 1) if [[ -z "$swagger_file" ]]; then echo "swagger.yaml not found" exit 1 fi rg -n '"url"' "$swagger_file"Length of output: 139
🏁 Script executed:
#!/bin/bash # Search for the swaggerDoc reference in the codebase rg -n "swaggerDoc" -n . # List any Swagger/OpenAPI definition files echo "Possible API spec files:" fd --extension yaml --extension yml --extension json --type f | grep -Ei 'swagger|openapi' # For each candidate spec file, show its servers or basePath settings for spec in $(fd --extension yaml --extension yml --extension json --type f | grep -Ei 'swagger|openapi'); do echo "=== Inspecting $spec ===" rg -n '"servers"' "$spec" || rg -n 'basePath' "$spec" doneLength of output: 729
🏁 Script executed:
#!/bin/bash # Show version and server/basePath details from Servers/swagger.yaml echo "=== Top 50 lines of Servers/swagger.yaml ===" head -n 50 Servers/swagger.yaml echo echo "=== Searching for host: entries ===" rg -n 'host:' Servers/swagger.yaml || echo "No host entries found" echo echo "=== Searching for basePath: entries ===" rg -n 'basePath:' Servers/swagger.yaml || echo "No basePath entries found"Length of output: 1784
Update Swagger server URL to include
/api
prefixIn
Servers/swagger.yaml
, theservers
block currently reads:servers: - url: http://localhost:3000 description: Local development serverIt should be updated to:
servers: - - url: http://localhost:3000 + - url: http://localhost:3000/api description: Local development server• Verify any health-check or monitoring endpoints (e.g.
/health
,/status
) have been moved under/api
(e.g./api/health
).
• Adjust any client-side or CI tests that still target root-level routes so they call/api/*
instead.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
Clients/src/infrastructure/api/customAxios.ts
(1 hunks)Servers/index.ts
(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
Clients/src/infrastructure/api/customAxios.ts (1)
Clients/env.vars.ts (1)
ENV_VARs
(1-4)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @samuel-coutinho
Describe your changes
Add
/api
prefix to endpoints.Write your issue number after "Fixes "
Fixes #1307
Please ensure all items are checked off before requesting a review:
Summary by CodeRabbit