nvsr

淘宝vip7层检测请求处理

npm install nvsr
4 downloads in the last week
8 downloads in the last month

Node Vip Status Responser

处理淘宝 vip 7层健康度检查请求

  • 支持原生 http module 与 connect middleware
  • 提供命令行工具可强制指定vip状态开关
var nvsr = new require('nvsr')({
    // health check function
    check_health: function(done){
        ... // do health check
        err = gotError ? new Error() : null
        done(err)
    },
    // listen stat switch sock for command line
    sock_path: "http-nvsr.sock"
    // health check timeout ms
    timeout : 500
})
// with http
var http = http.createServer(function(req, resp){
    nvsr.status(req, resp, function(req, resp){
        // you own codes
    })
})

// with connect
app.use nvsr.status
npm loves you