From the course: Firebase Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

The Search Restaurants function

The Search Restaurants function - Google Cloud Tutorial

From the course: Firebase Essential Training

Start my 1-month free trial

The Search Restaurants function

- [Instructor] Okay, the last cloud function we're going to implement in this section is a cloud function for searching restaurants, so that when the user types something in this search box here and clicks search, this list will change with a list of matching restaurants. And as I mentioned earlier, right now, we're only going to support searching restaurants by name, but this could obviously be extended to include some much more complex search functionality. So what we're going to do is start off by creating our function inside our functions directory. So inside our functions, source, restaurants directory, we're going to create a new file called searchRestaurants.js and hit enter. And our function is going to look like this. We're going to import * as functions from 'firebase-functions', import * as admin from 'firebase-admin', and export const searchRestaurants = functions.https.onCall, async (data, context). That's all…

Contents