First, create a project on Firebase
- https://firebase.google.com/docs/cli#install-cli-mac-linux
- Log in to firebase with
firebase login
- Select project with
firebase projects:list
- Cmd+Shift+F
your-app-name
and replace all project name instances with the name of your firebase project - Generate a new private key from https://console.firebase.google.com/u/0/project/your-app-name/settings/serviceaccounts/adminsdk
- Name the private key
serviceAccountKey.json
and it to the root directory of this project
- Note that the root folder is the project container, and the actual Node app is inside of
functions/
. - Meaning that you'll do git in one terminal tab at the root folder, and use another tab at
/functions
for running the API
cd functions
npm install
npm run dev
- Dev server will run at http://localhost:4001/your-app-name/us-central1/v1/
- Emulator dashboard will run at http://localhost:4000
Once you've connected your Firebase account,
cd functions
npm install
npm run deploy
Will deploy to Firebase
Note: POST params expect a JSON body
POST /widgets
- Create a widget.
title
: (optional) widget titledescription
: (optional) widget description
GET /widgets/:widgetId
- Read an widget. Response contains all the resources and their fields.