DEV Community

Discussion on: How To Solve Laravel 8 API Response that is returning welcome page instead of JSON

Collapse
 
kishita7 profile image
Kishita Variya • Edited

"Since I won't be using the web route so I decided to create a global JsonRequestMiddleware.... " It works great even when the app has web route (it does not affect the web route) - IFF you add it to protected

 $middlewareGroups = [
    'api' => [
// here
    ],
] 
Enter fullscreen mode Exit fullscreen mode

instead of $middleware in the Kernel.php file

Collapse
 
ife_adewunmi profile image
Ifeoluwa Adewunmi

Thank you for your feedback

Some comments have been hidden by the post's author - find out more