Boris56's avatar

Best Way: ajax and route

Hi,

I would like to know what is the best way to use Laravel roads with ajax calls.

Use the classic "web.php" routes use by php app or create specific routes in "api.php"?

I am asking for safety and good practice.

Thank you.

0 likes
5 replies
BishoyWagih's avatar

if you are making an api so you have to use api.php file

else use web.php file..

Snapey's avatar
Snapey
Best Answer
Level 122

if your user is authenticated then use web.php

Boris56's avatar

@Snapey Yes, is for use on admin panel, so use regular routes on web.php is better ?

Cronix's avatar

Yes, unless you want to make it more complex and issue tokens and stuff...

Please or to participate in this conversation.