progs/App4.js
changeset 530 6e08ee0d399d
parent 178 13c6bd6e3477
equal deleted inserted replaced
529:9b01bb695b22 530:6e08ee0d399d
    25         return 0
    25         return 0
    26     }
    26     }
    27 }
    27 }
    28 
    28 
    29 app.get('/', function(req, res){
    29 app.get('/', function(req, res){
    30     var counter = gt_cookie(req.cookies.counter) || 0;
    30     var counter = gt_cookie(req.cookies.counter || "") || 0;
    31     res.cookie('counter', mk_cookie(counter + 1));
    31     res.cookie('counter', mk_cookie(counter + 1));
    32     if (counter >= 5) {
    32     if (counter >= 5) {
    33         res.write('You are a valued customer ' +
    33         res.write('You are a valued customer ' +
    34                   'visting the site ' + counter + ' times.');
    34                   'visting the site ' + counter + ' times.');
    35     } else {
    35     } else {