zbyshekh zbyshekh - 15 days ago 6
PHP Question

I can't acces any route of Laravel's routes/api.php file

I'm working on laravel project.
I added in routes/api.php

Route::get('/lala', function (){
return "test";
});


And it doesn't show anything apart from:


NotFoundHttpException in RouteCollection.php line 161:


I added in routes/web.php

Route::get('/lala2', function (){
return "test2";
});


and the route works, I see "test2".

What could be te problem?

Answer

First remove the /lala from routes/api.php and add it into routes/web.php

Because routes/web.php file defines routes that are for your web interface.

you can get more route information from here.