Created
December 23, 2017 09:04
-
-
Save n1lesh/ed5ea4a706132b01cfdda3a1c540a163 to your computer and use it in GitHub Desktop.
Firebase Cloud Messaging with Node.js - FCM 2
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
app.get('/notifications', (req, res) => { | |
res.sendFile(__dirname + '/notifcenter.html') | |
}) | |
app.post('/store', (req, res) => { | |
MongoClient.connect(url, (err, db) => { | |
if (err) throw err | |
else { | |
db.collection('tokens').insertOne(req.body, (err, body) => { | |
if (err) throw err | |
res.sendStatus(200) | |
}) | |
} | |
db.close() | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment