can't use custom api route/controller while REST api enabled
mindshaped opened this issue · comments
Bug description
while in statamic versions up to 4.x we were able to add and access custom routes to /routes/api.php and reference custom controllers, while having the REST api activated at the same time – since statamic 5.x this doesn't seem to be working anymore (all custom api routes are generating a "message:Not found." json output) – is there something we've missed during the migration v4>v5 or is it a new restriction? – custom routes set in /routes/web.php are working fine with or without REST api enabled.
How to reproduce
- Enable REST api in config
- Create a new controller, i.e. with the "make:controller" command
- Put the controller in the subfolder "http/controllers/api/controllername.php
- reference the controller in "routes/api.php" through "Route::get('test',...)" command
- check the json output in browser "domain.test/api/test/"
Logs
No response
Environment
Environment
Application Name: Statamic
Laravel Version: 11.8.0
PHP Version: 8.2.18
Composer Version: 2.7.6
Environment: local
Debug Mode: ENABLED
URL: xyz.test
Maintenance Mode: OFF
Cache
Config: CACHED
Events: NOT CACHED
Routes: CACHED
Views: CACHED
Drivers
Broadcasting: null
Cache: statamic
Database: sqlite
Logs: stack / single
Mail: smtp
Queue: sync
Session: file
Statamic
Addons: 0
Sites: 1
Stache Watcher: Enabled
Static Caching: Disabled
Version: 5.7.2 PRO
Installation
Fresh statamic/statamic site via CLI
Additional details
No response
my bad! closing this as I somehow managed to lose and overlook the custom config settings in /config/app.php during the migration and the missing RouteServiceProvider was the issue here, nothing to do with any statamic or laravel versions:)