Skip to content

Instantly share code, notes, and snippets.

@ganeshkbhat
Created October 4, 2018 02:57
Show Gist options
  • Select an option

  • Save ganeshkbhat/523025cdd79ae8e0aa7eef594dd7049c to your computer and use it in GitHub Desktop.

Select an option

Save ganeshkbhat/523025cdd79ae8e0aa7eef594dd7049c to your computer and use it in GitHub Desktop.
ExpressJS Series: Getting the req.fresh
app.post("/someUrl", function(req, res) {
let isFresh = req.fresh;
if (!isFresh) {
res.status(403).send("Forbidden");
}
const contentBody = JSON.parse(req.body.toString('utf8'));
res.send(200).send({result:"Success", content: contentBody});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment