Answer the question
In order to leave comments, you need to log in
Why is express not returning res.send?
There is a method:
writeFile = ( name, pdfData, filename, callback ) ->
fs.writeFile filename, pdfData, { flags: 'wx' }, ( err ) ->
if err
callback ''
console.log err
else
callback name
console.log 'saved'
app.post '/upload', (( req, res, next ) ->
filename = path.join __dirname, '/../../public/media/' + req.body.name + '.pdf'
pdfData = new Buffer req.body.file, 'base64'
writeFile req.body.name, pdfData, filename, ( name ) ->
if name isnt ''
# console.log name
res.send 'Hello prev'
next()
), (req, res) ->
res.send 'Hello next'
Answer the question
In order to leave comments, you need to log in
In fact, the answer came, I just received it incorrectly on the client ...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question