Web and API in Laravel 5.6

Asked

Viewed 374 times

1

One could explain about the route changes in version 5.6 of Laravel, now has the web.php and api.php files, and which middleware the api is using.

Thank you.

1 answer

1

In fact, the file api.php is present since the version 5.3 of Laravel.

The basic difference is that the file api.php is where you will put the routes of your api if your application is based on a Rest api.

All the routes in this file will have by default the prefix /api, then if u set a route /login inside 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 on web.php.

Of course you can also use both at the same time if necessary :)

Here are the Laravel 5.3 releases.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.