Created
November 2, 2016 00:07
-
-
Save srph/02fd1271ca3033a0fbd68c41e35c4daf to your computer and use it in GitHub Desktop.
Laravel - Catch all except /api routes. Useful for SPAs inside Laravel.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
Route::get('{all}', function () { | |
return view('index'); | |
})->where('all', '^((?!api).)*'); |
You dont need to ignore api if you are using routes/api file because it is imported before the routes/web file by
You dont need to ignore api if you are using routes/api file because it is imported before the routes/web file by
Hi, I don't agree. You should still ignore API for debug purposes.
If you use a not allowed methode or route that's created wrong (Forgotten or typo). You'd like to get the Laravel arror instead of the SPA.
I still recommend ignoring /api
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thanks