Skip to content

Instantly share code, notes, and snippets.

@n1lesh
Created December 23, 2017 09:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save n1lesh/ed5ea4a706132b01cfdda3a1c540a163 to your computer and use it in GitHub Desktop.
Save n1lesh/ed5ea4a706132b01cfdda3a1c540a163 to your computer and use it in GitHub Desktop.
Firebase Cloud Messaging with Node.js - FCM 2
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