Created
June 15, 2018 02:03
-
-
Save dceddia/17fe2752532c95886b8d0f79258462fa to your computer and use it in GitHub Desktop.
Handle POST requests
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
// 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