How to end an express.js / node POST response?

前端 未结 7 1634
情歌与酒
情歌与酒 2020-12-28 12:51

Im trying to just stop the post request after I\'ve saved a document to the DB, ie:

app.post(\'/blah\'), function(req,res){ 
//my code does a bunch of stuff
         


        
相关标签:
7条回答
  • 2020-12-28 13:26

    Use --> res.status(204).send(); inside the post request

    if(err) {
    
       console.log(err);
    
    } else {
    
       res.status(204).send();
    
    }
    
    0 讨论(0)
提交回复
热议问题