This video is available to students only

Module 9 Summary

This lesson is a summary of the work we've done in Module 9.0.

📝 This module's quiz can be found - here.
🗒️ Solutions for this module's quiz can be found - here.

In this module, we'll set up the functionality that will allow users to search for a collection of listings based on location.

Server Project#

src/graphql/typeDefs.ts#

We've updated the root-level listings query field to accept an optional location argument. When the location argument is provided, the listings field is to return the collection of listings that pertain to the specific location that is being searched for.

src/graphql/resolvers/Listing/index.ts#

In the listings() resolver function within the listingResolvers map, we check to see if the location argument has been provided. If location exists, we determine the country, admin, and city of the location being searched for by using Google's Geocoding API. When the geocoded information of the location is determined, we query for the listings in the "listings" collection that have the country, admin, and/or city of the location being searched for.

src/lib/api/Google.ts#

In the Google object instance within the src/lib/api/Google.ts file, we've introduced a geocode() function that runs the Geocoding API from Google Maps services.

Start a new discussion. All notification go to the author.