Safely load api routes only when routes file exists - #6
prateekbhujel wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. WalkthroughThe application now checks whether Suggested reviewers: Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The missing API route file no longer prevents application boot, while normal API routing remains enabled when the file exists. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Warning Some tools did not complete. Review the errors below. 🔧 PHPStan (2.2.9)PHP Parse error: syntax error, unexpected token "->" in /vendor/phpunit/phpunit/src/Runner/Version.php on line 48 Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
Fixes #5
When bundling mobile applications with NativePHP, cleanup_exclude_files removes routes/api.php to keep mobile builds lean. However, bootstrap/app.php unconditionally required api: DIR . '/../routes/api.php', causing native:run on iOS and Android to fail during boot with: Failed to open stream: No such file or directory.
This checks file_exists before passing the path so web and local development loads API routes normally, while mobile bundles safely skip missing api routes without crashing.
Added Pest tests covering application boot both when routes/api.php exists and when it is missing.