I am writing a server and on post it saves the the req.body to a file with fs.
The client page continues to load on submit, does the writefile need to be asynchronous and if so what should the callback look like and why is the page still loading.
app.post('/', function(req,res) {
console.log(req.body)
fs.writeFileSync('data.txt', JSON.stringify(req.body))
})
Is this because I don't send a response?
via Sprout
No comments:
Post a Comment