I am learning nodejs to develop a app of mine. So I'm starting with the basic of the basic : creating a node server.
Here is the code :
var http = require(http);
http.createServer(function(req,res){
res.writeHead(200, {'content-type':'text/plain'});
res.end('Hello world');
}).listen(9001);
console.log('server is running on port 9001');
and what my console returned to me
gdiop@localhost:~/Desktop/learning/node.js> node index.js
assert.js:81
throw new assert.AssertionError({
^
AssertionError: missing path
at Module.require (module.js:495:3)
at require (internal/module.js:20:19)
at Object.<anonymous> (/home/gdiop/Desktop/learning/node.js/index.js:1:74)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:393:7)
gdiop@localhost:~/Desktop/learning/node.js>
Am I missing something here ... ?
via Gabriel D.
No comments:
Post a Comment