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

前端 未结 7 1640
情歌与酒
情歌与酒 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:25

    For future reference, you can also do:

    res.redirect('back');
    

    Basically this just redirects the browser back to the screen the request came from, in other words "refreshing" it. It's hacky and I wish there was a better way, but it works.

提交回复
热议问题