This question has already been answered:
Greetings to all, please devote
Standard Application, NodeJS + ExpressJS, Default URL
//наш URL в браузере - http://localhost:12345/ //к нему шлем запросы app.post('/',function(req, res){ //объявляем переменную var count = 0; //считаем что то важное count = function_count_search();//sql запрос на ~20 секунд // .. тут оч. важные вычисления .. // .. а тут еще более важные вычисления .. //отдаем конечные данные res.end("~"+count+"~"); }); In general, the count variable is given as undefined. It is given faster than the sql query is executed. Well, of course you can use Kalbeki! Or? Only here in the examples from the Internet including. From this forum, all examples end inside a function, but I need to be able to operate the variable freely, and give it to res.end ()
Can this be done in NodeJS? If yes, please give an example code