2 years ago

How do I define an API route?

Posted 2 years ago by malhayek

I never used Laravel to create API that return JSON. This time I have an application that need web routes and some API routes.

For my API route, I added the following route to my /routes/api.php file

Route::get('getinfo/{id}', '[email protected]')
    ->where('id', '[0-9]+');

However, when I go to / I get redirected to /home url.

What else that is different that I have to do to get the api routes to work?

Please sign in or create an account to participate in this conversation.