Add intentional latency in express

后端 未结 7 2069
暖寄归人
暖寄归人 2020-12-29 18:37

Im using express with node.js, and testing certain routes. I\'m doing this tute at http://coenraets.org/blog/2012/10/creating-a-rest-api-using-node-js-express-and-mongodb/

7条回答
  •  南方客
    南方客 (楼主)
    2020-12-29 19:18

    just add a comment on top of the solution of @maggocnx : put this middleware early (before your route handler)

    app.use(function(req,res,next){setTimeout(next,1000)});

提交回复
热议问题