export function watch(req, res, next) {
    res.success = success.bind({res:res, req:req});
    
    return next();
}

function success(data) {
    let resultPack;
    if (data ) {
        if ( data.success === undefined || data.success === true ) {
            resultPack = {data, success:true, code:200};
        }
        else {
            resultPack = data;
        }
    }else {
        resultPack = {code:500, success:false, msg:'result is null'};
    }
    this.res.send(resultPack);
}

