What are the differences in routing processing written in api.php and web.php in Laravel 5.3?
I want to know, if you use template rendering to create a web page, and ajax requests are also used, is it better to put the routing of this ajax request in api.php or web.php?
According to your description, it should obviously be placed in web.php.
Because you just have an ordinary web project, the routing in web.php uses the web middleware group.
If you put ajax routing in api.php without csrf protection, it is easy to cause program vulnerabilities, except for public resource requests.
api.php is used with Laravel passport to provide API services.
Essentially the same.
Put it wherever you feel like it.
I think it’s better to put it in web.php. Because from your description, it doesn’t look like an API.