var http = require('http'); var port = process.argv.slice(2); http.createserver(function (request, response) { response.writehead(200, {'content-type': 'text/plain'}); setinterval(function(){ response.write(new date() + "\n"); }, 1000); //response.end('hello world\n'); //we cant use .write after end. }).listen(port); console.log("server running @ http://127.0.0.1:" + port);
executing: node server.js 3000
gettint error:
throw new error('invalid listen argument: ' + h); ^ error: invalid listen argument: 3000
what miss?
in code port
appears empty array, it's not appropriate parameter listen()
try log port
before usage
Comments
Post a Comment