javascript - If a request hit to my socket at '/' route this function gets executed is it posiible to execute this code async? -


exports.check= function(fn){

process.nexttick(function(){ while (true) {     settimeout(function(){iconsole.log('what');fn(1)},15000)     console.log('ok') } }) 

}

var express = require('express') , http = require('http') , path = require('path');  var app = express(); tt=require('./tt') app.get('/test',function(req,res){  tt.check(function(err,data){     console.log(err)     console.log(data)     if(err){res.status(500).json({error : err})}     else{res.send(data)} }) })  , check function defined in question. 

Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -