May 24, 2021
9
Level 2
Web app and API in same Laravel project?
is it possible.? to make web application and API in same laravel project
Level 9
routes/web.php
Route::get('/', function () {
return "Hi from web";
});
Outputs
Hi from web
routes/api.php
Route::get('/', function () {
return "Hi from api";
});
Outputs
Hi from api
For more information on APIs
https://www.youtube.com/playlist?list=PL8p2I9GklV45xlp9M1NKOqwJxDAXBrCuf https://www.youtube.com/watch?v=MT-GJQIY3EU
Edit :
Web routes use the web middleware
Api routes use the api middleware
https://github.com/laravel/laravel/blob/master/app/Http/Kernel.php#L29-L44
2 likes
Please or to participate in this conversation.