/firesite_backend

Server-side code to accompany firesite repo

Primary LanguageJavaScriptMIT LicenseMIT

firesite_backend

Server-side code to accompany firesite repo

The Firesite project combines some code/steps I found myself repeating over and over while building some small websites on top of Firebase. The code in this repo assists in developing the server side / cloud functions. Ideally it'd live in the same repo as Firesite, but I spent way too much time battling Node and other tools trying to get that to work (I don't want websites to fork this project, but to just use the code in a way that's easy to keep them up to date as more features are added), so for now I'm punting and splitting things into two separate projects.

This project supplies a ready-made backend login function (assuming you are willing to abide by its conventions), some ease-of-use helpers, and some wrappers for making it easier to expose APIs to the client side of things.

Setup

It is assumed that you've already been through the setup work for setting up a Firesite project.

  1. Create a 'functions' directory if one does not already exist (and if it did not exist, run 'npm init' in it).
  2. cd into the functions dir.
  3. Run git clone git@github.com:dfb/firesite_backend.git firesite
  4. Run npm i uuid firebase-admin firebase-functions
  5. Run cp firesite/starter_files/* .

Usage

If all you need to do is support logging in, the instructions in the Setup section are sufficient. If you want to expose additional cloud functions to call from your website, define them and expose them in the firesite.jsonapis.Expose line. See jsonapis.js for information on conventions, especially on controlling access. Be careful that you don't expose powerful functions to anonymous users!

To deploy modifications: firebsae deploy --only functions