-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Add api group to RouteServiceProvider #3724
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
Conversation
Not sure we need this in the default app. |
I'm not sure either, because sure: it's quite simple to add it when needed. But since there are already some questions surrounding the new way routes work, this addition might help make it more clear where to put routes for another middleware group. |
I agree with @prullenbak that this would make it a lot more obvious where to put routes in other middleware groups. However, I wonder if One alternative would be to create a new
|
Thanks @philbates35, because of your comment I spotted a mistake. It should be routes-api.php, but I made a mistake in the service provider. Will fix that. However, maybe your idea is even better :) |
It's clear that everyone has their own way of doing things. |
For that reason, this is unnecessary. |
The current example routes file gives new-comers a flavour of how they can get stuff working, and more experienced users probably already have their own preference on how they want to setup their routing. One way that I do things is like this: https://github.com/CachetHQ/Cachet/tree/master/app/Http/Routes, https://github.com/CachetHQ/Cachet/blob/master/app/Foundation/Providers/RouteServiceProvider.php#L68. |
I will, however re-open this, as the decision ultimately lies with Taylor. |
I understand that this can be done in multiple ways, but that's the case with everythting in Laravel. |
I think this is a change that should be discussed on the |
Now that the web middleware group is used by default for all routes in routes.php, the question came up on the laracasts forum: how to add api routes?
Maybe this is a simple addition to the RouteServiceProvider: load in routes-api.php with the default api middleware group.