You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This in general is no big deal until you start integrating 3rd party packages like laravel-roles which use the 'web' middleware internally for their builtin admin panel.
I used that package in my project and realized the proper way to do this is to restore the 'web' middleware group and create a new one for my SPA index only. I added a new mapping to the RouteServiceProvider as below and moved the spa index endpoint to a new routes file.
/** * Define the "spa" routes for the application. * * These routes are typically stateless. * * @return void */protectedfunctionmapSpaRoutes()
{
Route::middleware('spa')
->namespace($this->namespace)
->group(base_path('routes/spa.php'));
}
This allows me to have the API routes, SPA application and MVC based administration panel working side-by-side.
The text was updated successfully, but these errors were encountered:
Firtzberg
changed the title
Moe index route to new route group
Move index route to new route group
Apr 9, 2020
The index route in the routes/web.php is misplaced and web middleware group not appropriate for web requests. The web routes and middleware are meant for session related requests as you can read in the app/Providers/RouteServiceProvider.php.
This in general is no big deal until you start integrating 3rd party packages like laravel-roles which use the 'web' middleware internally for their builtin admin panel.
I used that package in my project and realized the proper way to do this is to restore the 'web' middleware group and create a new one for my SPA index only. I added a new mapping to the RouteServiceProvider as below and moved the spa index endpoint to a new routes file.
This allows me to have the API routes, SPA application and MVC based administration panel working side-by-side.
The text was updated successfully, but these errors were encountered: