I am reading the code of a chat project as a demo for socket.io
In index.js, here is a snippet:
var app = require('express')();
var http = require('http').Server(app);
var io = require('socket.io')(http);
So I use Node.JS debugger:
var app = require('express')();
var http = require('http').Server(app);
var io = require('socket.io')(http);
// add:
debugger;
watch("io");
The command is:
node debug index.js
It stops at var io = ... But I don't know how to get the information of the object "io". Actually when I type io in the terminal, it says: io is not defined.
if I type http, it will output the definition of http.
If I type app, it says: app is not defined.
I am confused. How to do it?
Just type 'repl' in 'debug >' prompt and then you can type and get all variables values
I use node inspector. It works like a charm.