Setup Backend - Cloud Functions


Setup Backend - Cloud Functions

{warning} if you did not deploy Cloud Functions the you will see no users. more info

download the NodeJS (LTS Version) and install it on your Computer. then open Command Prompt or Terminal on your computer and type the command

npm install -g firebase-tools

this will install the firebase tools which is used to deploy your functions next up create a new Folder on your computer . if you're on Windows hold 'shift' then 'Right-click' and choose 'open command window here' to open up a command prompt in this folder then type the command:

firebase login

this will open up the Browser on your Computer to associate the Functions on your PC with Firebase Project then type the command:

firebase init functions

this will link your cloud functions with your firebase Project that you've created before.

now complete the steps in command line and choose the Project that you've Created image

then choose JavaScript as the language , don't use ESLint , and don't install dependencies

now we have to deploy our functions to Firebase.

  • copy the files index.js and package.json from 'Backend - Cloud Functions' folder and paste them in the project folder that you've created in 'functions' directory and replace them

  • now inside functions folder open command prompt using 'open command window here' and type the command

    npm install
  • finally run the command

    firebase deploy

you should see something like this if deploy process was succeeded

image

{warning} if you have the error about 'engines' in 'package.json' please download new package.json and replace it with yours and try deploying again.