How can i put a loop in this server

前端 未结 3 1197
臣服心动
臣服心动 2021-01-25 01:15

For example, something similar i want to do:

var http = require(\'http\');

const PORT=8080;
var myvar = \"Test: \";

function handleRequest(request, response){
         


        
3条回答
  •  时光说笑
    2021-01-25 01:47

    I'm not sure but you can try to send request to your own node server via http or use restler node module.

    function recursive() {
        http.request(url, function(err, res) {
            recursive();
        })
    }
    

    https://nodejs.org/api/http.html#http_http_request_options_callback

    And call this method when you want to start your recursion.

提交回复
热议问题