Commit e3c867a5 authored by Johannes Bill's avatar Johannes Bill

after cb refactor

parent d1b5b124
var http = require('http'); var http = require('http');
var hostname= "127.0.0.1"; var hostname= "127.0.0.255";
var port= 3001; var port= 3001;
var headers = { var headers = {
"Content-Type": "application/json" "Content-Type": "application/json"
...@@ -17,7 +17,6 @@ function request(path, cb) { ...@@ -17,7 +17,6 @@ function request(path, cb) {
}; };
var callback = function (response) { var callback = function (response) {
console.log('bla');
var str = ''; var str = '';
response.on('data', function (chunk) { response.on('data', function (chunk) {
str += chunk; str += chunk;
...@@ -31,11 +30,17 @@ function request(path, cb) { ...@@ -31,11 +30,17 @@ function request(path, cb) {
req.on("error", function (err) { req.on("error", function (err) {
cb(err); cb(err);
}); });
req.setTimeout(500, function() {
req.abort();
});
req.end(); req.end();
} }
request(path, function(err, res) {
console.log(err);
console.log(res);
});
function getBundesland(plz, cb) { function getBundesland(plz, cb) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment