source: https://firebase.google.com/docs/functions

How cook a Cron job with the Firebase Functions

source: https://giphy.com/gifs/mic-jimmy-fallon-the-roots-star-wars-force-awakens-dRXSJTNTfr9AI

The recipe: what we need

% npm i -g firebase-tools
% cd test-cron-on-firebase
% firebase init
? Which Firebase CLI features do you want to set up for this folder? Press Space to select features, then Enter to confirm your choices.◯ Database: Deploy Firebase Realtime Database Rules
◯ Firestore: Deploy rules and create indexes for Firestore
❯◉ Functions: Configure and deploy Cloud Functions
◯ Hosting: Configure and deploy Firebase Hosting sites
◯ Storage: Deploy Cloud Storage security rules
◯ Emulators: Set up local emulators for Firebase features
First, let's associate this project directory with a Firebase project.You can create multiple project aliases by running firebase use --add,but for now we'll just set up a default project? Please select an option: (Use arrow keys)❯ Use an existing project
Create a new project
Add Firebase to an existing Google Cloud Platform project
Don't set up a default project
├── firebase.json
└── functions
├── index.js
├── package-lock.json
└── package.json
% firebase deploy
https://<project_name>.cloudfunctions.net/calculateHalving
source https://giphy.com/gifs/cbs-young-and-restless-the-tyatr219-j05OpWhQmoNXDsNC0T

I have not implemented the sending of email because there are many other articles about it and many other npm libraries.

--

--

Staff Software Engineer Android @ Moneyfarm

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store