This is the full Cloud Functions code explained in my blog post: How to schedule a Cloud Function to run in the future (in order to build a Firestore document TTL)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export function parseQuery(query) { | |
| query = query.substring(query.indexOf("?") + 1); | |
| var re = /([^&=]+)=?([^&]*)/g; | |
| var decodeRE = /\+/g; | |
| var decode = function (str) { | |
| return decodeURIComponent(str.replace(decodeRE, " ")); | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Reference from https://medium.com/@Astider/how-to-สร้าง-messenger-chatbot-แบบ-serverless-ด้วย-google-firebase-908c3eaba67e | |
| const functions = require('firebase-functions'); | |
| // The Firebase Admin SDK to access the Firebase Realtime Database. | |
| const admin = require('firebase-admin'); | |
| admin.initializeApp(functions.config().firebase); | |
| // Create and Deploy Your First Cloud Functions | |
| // https://firebase.google.com/docs/functions/write-firebase-functions |