I need to catch all routes, except those that have /api/ segment in them. I know how to catch every single route
Route::any('{all}', 'AngularController@serveFrontend')->where('all', '(.*)');
But what do I need to change so that my api routes aren't captured by this string ?
You can catch all routes where the path does not start with api
Route::any('{all}', 'AngularController@serveFrontend')->where('all', '^(?!api).*$');
Or simply leave your catchall as the last route and it'll work as expected.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With