global.test1 = ''; app.get('/test1', function(req, res) { global.test1 = ''; global.test1 += '1'; global.test1 += '2'; global.test1 += '3'; global.test1 += '4'; global.test1 += '5'; if (global.test1 != '12345') { console.log('not match: ' + global.test1); } res.end(global.test1.toString()); }); global.test2 = ''; app.get('/test2', function(req, res) { global.test2 = ''; var i = 0; var interval; var append = function() { i += 1; global.test2 += i.toString(); if (i == 10) { clearInterval(interval); if (global.test2 != '12345678910') { console.log('not match: ' + global.test2); } res.end(global.test2); } }; interval = setInterval(append, 1); }); global.test4and5 = ''; app.get('/test4', function(req, res) { global.test4and5 = ''; global.test4and5 += '1'; global.test4and5 += '2'; global.test4and5 += '3'; global.test4and5 += '4'; global.test4and5 += '5'; if (global.test4and5 != '12345') { console.log('not match: ' + global.test4and5); } res.end(global.test4and5.toString()); }); app.get('/test5', function(req, res) { global.test4and5 = ''; global.test4and5 = ''; global.test4and5 += 'A'; global.test4and5 += 'B'; global.test4and5 += 'C'; global.test4and5 += 'D'; global.test4and5 += 'E'; if (global.test4and5 != 'ABCDE') { console.log('not match: ' + global.test4and5); } res.end(global.test4and5.toString()); });