Skip to content

Conversation

@lightninglu10
Copy link
Contributor

@lightninglu10 lightninglu10 commented Jun 27, 2025

Update API Path Prefix from /api to /v1

This PR updates the base API path used by the server from /api/ to /v1/ and adjusts related test cases to match.

Key Changes:

  • Modified src/server.js to construct API URLs with a /v1/ prefix instead of /api/.
  • Updated test/server.test.js to reflect the new /v1/ path in expected URLs for API calls.

Review Notes:

  • This change introduces a new API version prefix. Please ensure that all dependent services or clients are updated to use the new /v1/ path simultaneously to avoid service disruption.
  • Verify that all API endpoints continue to function as expected after this path change.

@lightninglu10 lightninglu10 self-assigned this Jun 27, 2025
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❇️ CodePress Review Summary

👋 Hey team,

Overall the changes look great! I left 2 helpful notes inline.

Here's the quick rundown:

❌ Decision: REQUEST CHANGES
While the code change is straightforward, this is a breaking change for API consumers. It requires careful coordination with client updates, which is not evident from the PR itself. Further context or a deployment plan is needed.

👍 What's working well

The updated unit tests for the new /v1/ API path prefix are commendable. This ensures continued test coverage and validates the breaking change, which is crucial for maintaining stability.

ℹ️ Other thoughts

The API path prefix update is correctly implemented, though it's important to note this is a breaking change requiring coordinated client deployment. For future extensibility and easier version management, consider making the API version a configurable constant.

const url = `${protocol}://${apiHost}${
apiPort ? `:${apiPort}` : ""
}/api/${apiPath}`;
}/v1/${apiPath}`;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ FYI: This change correctly updates the API path prefix. As noted in the diff context, this is a breaking change and requires coordinated deployment with all API clients. For future extensibility, consider making the API version (v1) a configurable constant if there's a foreseeable need to support multiple API versions concurrently or to easily update the version string.

const protocol =
apiHost === "localhost" || apiHost === "127.0.0.1" ? "http" : "https";
const expectedUrl = `${protocol}://${apiHost}:${apiPort}/api/${endpoint}`;
const expectedUrl = `${protocol}://${apiHost}:${apiPort}/v1/${endpoint}`;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏 PRAISE: Good to see the unit tests are updated to reflect the new /v1/ API path prefix, ensuring test coverage for this breaking change.

@lightninglu10 lightninglu10 merged commit 9d30ead into main Jun 27, 2025
1 check passed
@lightninglu10 lightninglu10 deleted the api-path branch June 27, 2025 17:44
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