Someone could explain the route changes in version 5.6 of Laravel, now has the files web.php and api.php, and what middleware api is using.
Thank you.
Someone could explain the route changes in version 5.6 of Laravel, now has the files web.php and api.php, and what middleware api is using.
Thank you.
In fact, the file api.php
is present since the 5.3
version of Laravel.
The basic difference is that the api.php
file is where you will place the routes of your api, if your application is based on an api rest.
All routes in this file will default to /api
, so if you set a /login
route within the file, the prefix will be added and the final route will be /api/login
.
If you are going to make a normal web application, following the MVC standard, by convention you will define your routes in web.php
.
Of course you can also use both at the same time, if necessary:)