firebase-functions-express-example
firebase-functions-express-example copied to clipboard
Express server running on Cloud Functions for Firebase
THIS REPO HAS BEEN MOVED
This example has been merged into my blog-examples repo. This repo will no longer be updated.
Express Server on Cloud Functions for Firebase
Host an Express Server in Cloud Functions for Firebase.
Here is the accompanying Medium Post.
TLDR;
Host your Express Server on Cloud Functions enabling a low-cost, auto-scaling web server leveraging Firebase's sweet developer experience.
Cloud Functions uses Express request and response objects allowing us to pass an Express app directly into the function.
File of interest:
- functions/index.js
Installation
git clone https://github.com/jthegedus/firebase-functions-express-example
cd firebase-functions-express-example
yarn install
Local Development
yarn serve
This will serve the Cloud Functions locally using the Firebase emulator. Interestingly, the trailing /
is not an issue when hosted locally.
Deploy to Firebase
yarn deploy
N.B.: Replace <project-name>
in the .firebaserc
to connect the project to your Firebase project.
A note on Code Compatibility
Everything was tested on Ubuntu 16.04 & Windows 10 with Bash on Ubuntu on Windows. If you wish for Windows native support please submit an issue so we can work on a Windows branch. Please report any macOS errors as I do not have access to a device to test. My development environment can be found here.