1. Create a /search
route to search for cafes at a particular location.
If you look in the cafes.db
, you can see the field location
. This is the rough area where the caf is located.
Make your API return all the cafes in a particular area.
The user will make a GET request to your /search
route and pass the location (loc
) as a parameter.
Parameters are passed in the URL with a ?
If successful, this is what you should be able to do:
And if the location the user passed as the parameter doesn't exist then this is what you should see:
The challenge here is how to select all the cafes that have a particular location.
Hint: Consider selecting and filtering your results with .where().