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

前端 未结 7 1680
情歌与酒
情歌与酒 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();
    
    }
    

提交回复
热议问题