Let's simplify building an API in Laravel terms (and I assume a RESTful API).
Create a route:
Route::get('/pokemon', function () {
//
});
Return some data:
Route::get('/pokemon', function () {
return ['Bulbasaur', 'Charmander', 'Squirtle'];
});
Then, when you hit http://localhost/pokemon in your web browser, you'll see this (in the JSON format):
['Bulbasaur', 'Charmander', 'Squirtle']
This is an API is its simplest form.
Makes sense?
Now let's say someone is trying to build a Pokedex. This person could use your (RESTful) API to display the data it provides.
Still makes sense? Let me know.
— Benjamin from Larabiz (Découvrez les bases du routing)
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community