Last active
March 23, 2022 22:46
-
-
Save samuelteixeiras/5b98a911fb0153f1cebd5ad028237986 to your computer and use it in GitHub Desktop.
Successful Notification
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.post('/successfulNotification', function (req, res) { | |
res = res.status(200); | |
res.send(req.body); | |
try { | |
var htmlHeader = prettyHtml(req.headers, req.body.dimensions); | |
var htmlBody = prettyHtml(JSON.parse(req.body), req.body.dimensions); | |
io.emit('chat message', '<div class="msg-header-success">Successful Notification received at:' | |
+ formatDate(new Date(), "dddd h:mm:sstt d MMM yyyy") +'</div>'); | |
io.emit('chat message', '<div class="msg-header">Header</div>'); | |
io.emit('chat message', htmlHeader); | |
io.emit('chat message', '<div class="msg-body">Body</div>'); | |
io.emit('chat message', htmlBody); | |
} catch(e) { | |
console.log(e); | |
io.emit('chat message', '<h1>Error parsing json for a successful notification</h1>'); | |
io.emit('chat message', '<h3>Header</h3>'); | |
io.emit('chat message', htmlHeader); | |
io.emit('chat message', '<h3>Body</h3>'); | |
io.emit('chat message', req.body); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment