Skip to content

Instantly share code, notes, and snippets.

@hiranya911
Created October 25, 2020 00:10
Show Gist options
  • Save hiranya911/9393c908a0c365a7c488afb546f5c7ec to your computer and use it in GitHub Desktop.
Save hiranya911/9393c908a0c365a7c488afb546f5c7ec to your computer and use it in GitHub Desktop.
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