Skip to content

[5.3] Map API routes before Web routes #3929

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 5, 2016

Conversation

bryceadams
Copy link
Contributor

When developing SPAs, it makes sense to have a 'catchall' route and then handle the routing with javascript (like with vue-router). It would also make sense to have some API endpoints for the SPA to talk to.

However, if you were to add a catchall to the web.php routes and then some API endpoints to the api.php routes, the api.php routes would be ignored as the catchall takes precedence, since web.php routes are mapped first.

This PR proposes that we map API routes first, so that those routes take priority before a catchall / similar route is set by web.php.

Here is the proposal in internals: laravel/ideas#187

@taylorotwell taylorotwell merged commit 7f06559 into laravel:master Sep 5, 2016
@bryceadams bryceadams deleted the patch-map-api-before-web branch September 5, 2016 23:25
@vlakoff
Copy link
Contributor

vlakoff commented Oct 5, 2016

Maybe a comment about this should be added in the code?

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.

3 participants