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
Post a Comment