Created
October 25, 2020 00:10
-
-
Save hiranya911/9393c908a0c365a7c488afb546f5c7ec to your computer and use it in GitHub Desktop.
This file contains 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
const admin = require('firebase-admin'); | |
function enableRequestLogger() { | |
const https = require('https'); | |
const original = https.request | |
https.request = function(options, callback){ | |
console.log(`${new Date().toISOString()} ${options.method} ${options.protocol}//${options.hostname}${options.path}`); | |
return original(options, callback); | |
} | |
} | |
enableRequestLogger(); | |
const app = admin.initializeApp(); | |
(async () => { | |
const messageId = await admin.messaging().send({ | |
topic: 'test', | |
notification: { | |
title: 'Hello world!', | |
}, | |
}); | |
console.log(messageId); | |
await app.delete(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment