This sample shows how to create various images through Functions and serve it to the client
It uses node-canvas to create a canvas environment on Node. That canvas is then used to create either a clock, sparkline chart, or sphere(s) in png format. The images are then cached on the server and sent to the client in image/png
format.
- Create a Firebase Project using the Firebase Console.
- Clone or download this repo and open the
image-maker
directory. - You must have the Firebase CLI installed. If you don't have it install it with
npm install -g firebase-tools
and then configure it withfirebase login
. - Configure the CLI locally by using
firebase use --add
and select your project in the list. - Install dependencies locally by running:
cd functions; npm install;
This sample comes with a web-based UI for testing the function. To test locally do:
- Start serving your project locally using
firebase serve --only hosting,functions
- Open the app in a browser at
https://localhost:5000
.
To deploy and test on prod do:
- Deploy your project using
firebase deploy
- Open the app using
firebase open hosting:site
, this will open a browser.
We'd love that you contribute to the project. Before doing so please read our Contributor guide.
© Google, 2017. Licensed under an Apache-2 license.