Node.js unhandled 'error' event

后端 未结 6 1899
广开言路
广开言路 2021-02-02 08:14

I have written a simple code and save it in file try.js .

var http = require(\'http\');
var makeRequest = function(message) {
  var options = {
    host: \'loca         


        
6条回答
  •  佛祖请我去吃肉
    2021-02-02 08:33

    This is happening because nothing is listening on localhost:8080. Here are the examples how to handle request errors How to catch http client request exceptions in node.js

提交回复
热议问题