Building an API / JSON based route for searching
In Chapter 6, Adding Angular to Your App we will cover Angular and in there I needed to make an API for the widget to talk to. Let's review that again here in more detail.
Getting ready
A fresh install of Laravel will do.
How to do it...
Follow the steps to build an API / JSON route for searching:
- Add our controller:
> php artisan make:controller SearchComics
- Add our route:
- Fill in the controller:
- And in the
ComicClientInterface
class, I handle thecomics
method like this. I will go into more details in the ...
Get Laravel 5.x Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.