progs/App3.js
changeset 534 62985f147c85
parent 530 6e08ee0d399d
equal deleted inserted replaced
533:98ae49ffc262 534:62985f147c85
    22         return 0
    22         return 0
    23     }
    23     }
    24 }
    24 }
    25 
    25 
    26 app.get('/', function(req, res){
    26 app.get('/', function(req, res){
    27     var counter = gt_cookie(req.cookies.counter) || 0;
    27     var counter = gt_cookie(req.cookies.counter || "") || 0;
    28     res.cookie('counter', mk_cookie(counter + 1));
    28     res.cookie('counter', mk_cookie(counter + 1));
    29     if (counter >= 5) {
    29     if (counter >= 5) {
    30         res.write('You are a valued customer ' + 
    30         res.write('You are a valued customer ' + 
    31                   'visting the site ' + counter + ' times.');
    31                   'visting the site ' + counter + ' times.');
    32     } else {
    32     } else {