If you installed Laravel after 5.2.26, you will have the 'web' group applied to all your routes in routes.php. To add API routes that don't need the 'web' middleware group you can create another routes file to hold those routes and load them in your RouteServiceProvider separately.
- Create a
api-routes.phpfile in the same directory as yourroutes.phpfile. - Put your API routes in the
api-routes.phpfile. - Adjust your
RouteServiceProvider(app/Providers/RouterServiceProvider.php) to add what is in the exampleRouteServiceProviderprovided.- Adjust
namespaceandmiddlewarevalues of the array passed togroupinmapApiRoutesto what you would like.
- Adjust