How can I send a success status to browser from nodejs/express?

前端 未结 4 1405
南笙
南笙 2021-02-02 05:13

I\'ve written the following piece of code in my nodeJS/Expressjs server:

app.post(\'/settings\', function(req, res){
    var myData = {
        a: req.param(\'a\         


        
4条回答
  •  攒了一身酷
    2021-02-02 05:36

    In express 4 you should do:

    res.status(200).json({status:"ok"})
    

    instead of the deprecated:

    res.json(200,{status:"ok"})
    

提交回复
热议问题