SHOW:
|
|
- or go back to the newest paste.
| 1 | It was a typo - i.e, common newbie mistake | |
| 2 | ||
| 3 | /Node/chat_ex/index.js:8 | |
| 4 | http:listen(3000, function(){
| |
| 5 | ^ | |
| 6 | ******************************** | |
| 7 | should be: | |
| 8 | http.listen(3000, function(){
| |
| 9 | ||
| 10 | ******************************** | |
| 11 | ||
| 12 | ReferenceError: listen is not defined | |
| 13 | at Object.<anonymous> (/home/rfmonk/Node/chat_ex/index.js:8:6) | |
| 14 | at Module._compile (module.js:456:26) | |
| 15 | at Object.Module._extensions..js (module.js:474:10) | |
| 16 | at Module.load (module.js:356:32) | |
| 17 | at Function.Module._load (module.js:312:12) | |
| 18 | at Function.Module.runMain (module.js:497:10) | |
| 19 | at startup (node.js:119:16) | |
| 20 | at node.js:906:3 | |
| 21 | ||
| 22 | var app = require('express')();
| |
| 23 | var http = require('http').Server(app);
| |
| 24 | ||
| 25 | app.get('/', function(req, res){
| |
| 26 | res.send('<h1>Hello world</h1>');
| |
| 27 | }); | |
| 28 | ||
| 29 | http:listen(3000, function(){
| |
| 30 | console.log('listening on *:3000');
| |
| 31 | }); |