Skip to content

Instantly share code, notes, and snippets.

@dceddia dceddia/server.js
Created Jun 15, 2018

Embed
What would you like to do?
Handle POST requests
// Store the single image in memory.
let latestPhoto = null;
// Upload the latest photo for this session
app.post('/', (req, res) => {
// Very light error handling
if(!req.body) return res.sendStatus(400);
console.log('got photo')
// Update the image and respond happily
latestPhoto = req.body.photo;
res.sendStatus(200);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.