Skip to content

Conversation

@kevalyq
Copy link
Contributor

@kevalyq kevalyq commented Nov 15, 2025

Fixes #168

Summary

Removes the redundant /api/ prefix from all routes. Routes are now accessible at /v1/* instead of /api/v1/*, aligning internal routing with production API URLs.

Breaking Changes

⚠️ BREAKING CHANGE: Routes now accessible at /v1/* instead of /api/v1/*

Impact: Since we're v0.x.x, breaking changes are allowed per semantic versioning.

Changes

  • Set apiPrefix: '' in bootstrap/app.php (Laravel 12 configuration)
  • Updated all 167 test URLs from /api/v1/* to /v1/*
  • Updated health endpoint tests from /api/health to /health

Rationale

Before (Inconsistent):

  • Internal routing: /api/v1/users
  • Production URL: https://api.secpal.app/v1/users
  • Mismatch: /api/ only exists internally!

After (Consistent):

  • Internal routing: /v1/users
  • Production URL: https://api.secpal.app/v1/users
  • Match: No cognitive overhead! ✅

Quality Checks

  • ✅ All 279 tests passing (916 assertions)
  • Laravel Pint: PASS (103 files)
  • PHPStan Level Max: No errors
  • REUSE 3.3: 180/180 compliant
  • Preflight: All checks passed

Why Now?

This was identified during PR #162 where we had to fix 9 documentation files because they incorrectly documented the API as using /api/v1/ prefix. The root cause was this routing inconsistency.

Related

Fixes #168

BREAKING CHANGE: Routes now accessible at /v1/* instead of /api/v1/*

This change aligns internal routing with production API URLs.

Changes:
- Set apiPrefix="" in bootstrap/app.php (Laravel 12)
- Updated all 167 test URLs from /api/v1/* to /v1/*
- Updated health endpoint tests from /api/health to /health

Rationale:
- Production URL: https://api.secpal.app/v1/users
- Old internal: /api/v1/users (confusing)
- New internal: /v1/users (matches production)

Quality Checks:
✅ All 279 tests passing (916 assertions)
✅ Laravel Pint: PASS (103 files)
✅ PHPStan Level Max: No errors

Impact: Since we are v0.x.x, breaking changes are allowed.
Copilot AI review requested due to automatic review settings November 15, 2025 13:29
@github-actions
Copy link

💡 Tip: Consider Using Draft PRs

Benefits of opening PRs as drafts initially:

  • 💰 Saves CI runtime and Copilot review credits
  • 🎯 Automatically sets linked issues to "🚧 In Progress" status
  • 🚀 Mark "Ready for review" when done to trigger full CI pipeline

How to convert:

  1. Click "Still in progress? Convert to draft" in the sidebar, OR
  2. Use gh pr ready when ready for review

This is just a friendly reminder - feel free to continue as is! 😊

Copilot finished reviewing on behalf of kevalyq November 15, 2025 13:31
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR removes the redundant /api/ prefix from all routes by setting apiPrefix: '' in Laravel 12's bootstrap/app.php configuration. This aligns internal routing (/v1/*) with production API URLs (https://api.secpal.app/v1/*), eliminating cognitive overhead. All 167 test URLs have been updated from /api/v1/* to /v1/*, and health endpoint tests updated from /api/health to /health.

Key Changes

  • Configured apiPrefix: '' in bootstrap/app.php to remove the /api/ prefix
  • Updated all test files to use /v1/* instead of /api/v1/* for versioned API routes
  • Updated health endpoint tests from /api/health to /health

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.

Show a summary per file
File Description
bootstrap/app.php Added apiPrefix: '' configuration to remove /api/ prefix from routes
tests/Feature/UserPermissionAssignmentApiTest.php Updated 15 test URLs from /api/v1/* to /v1/*
tests/Feature/RoleManagementApiTest.php Updated 29 test URLs from /api/v1/* to /v1/*
tests/Feature/RoleApiTest.php Updated 22 test URLs from /api/v1/* to /v1/*
tests/Feature/PersonApiTest.php Updated 11 test URLs from /api/v1/* to /v1/*
tests/Feature/PermissionManagementApiTest.php Updated 20 test URLs from /api/v1/* to /v1/*
tests/Feature/LocaleMiddlewareTest.php Updated 5 health endpoint tests from /api/health to /health
tests/Feature/Integration/RbacIntegrationTest.php Updated 17 test URLs from /api/v1/* to /v1/*
tests/Feature/ExampleTest.php Updated health endpoint test from /api/health to /health
tests/Feature/AuthTest.php Updated 19 test URLs from /api/v1/* to /v1/*
tests/Feature/Auth/PasswordResetTest.php Updated 9 test URLs and 1 docblock from /api/v1/* to /v1/*
tests/Feature/Auth/PasswordResetRequestTest.php Updated 8 test URLs and 1 docblock from /api/v1/* to /v1/*

@kevalyq kevalyq merged commit 30ecf3e into main Nov 15, 2025
26 checks passed
@kevalyq kevalyq deleted the refactor/remove-api-prefix branch November 15, 2025 13:32
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.

Remove redundant /api/ prefix from route definitions

2 participants