Skip to content

Setup and usage for backend development

Julian Lioanag edited this page Oct 9, 2020 · 2 revisions

Setup/Install

  1. Install npm (which is installed in addition to Node.js): https://nodejs.org/en/.
  2. Go into functions directory in the smartrider repository and run npm install ..
    • This installs node-gtfs.
  3. Install TypeScript with npm: npm install typescript.
  4. Install Firebase CLI reference with npm: npm install -g firebase-tools.
  5. Install Talend API Tester chrome extension.
    • We use this to test cloud functions on your personal machine.

Running cloud functions locally

  1. Run npx tsc to compile Typescript to JavaScript.
  2. Run firebase emulators:start --only functions to start the emulator.
  3. Click on the Talend API chrome extension and paste the appropriate localhost URL from the emulator.
    • Example in the command prompt: + functions[helloWorld]: http function initialized (http://localhost:5001/smartrider-4e9e8/us-central1/helloWorld).
    • If you want to just look at the raw JSON just open that localhost URL on a web browser.
  4. Click Send to send a request locally.
    • 200 means it worked; 500 means ERROR.

Clone this wiki locally