Web and API in Laravel 5.6

0

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.

    
asked by anonymous 29.03.2018 / 23:22

1 answer

0

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:)

Here are the release notes of Laravel 5.3 .

    
30.03.2018 / 01:44