-
Notifications
You must be signed in to change notification settings - Fork 77
Expand file tree
/
Copy pathexample.js
More file actions
28 lines (24 loc) · 761 Bytes
/
example.js
File metadata and controls
28 lines (24 loc) · 761 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
var agent = require('./index');
// Assume this HTTP service is your service
var http = require('http');
http.createServer(function (req, res) {
console.log('boooo');
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(9000, '127.0.0.1');
console.log('Server running at http://127.0.0.1:9000/ , pid-> ' + process.pid);
// Now let's have a signal handler for SIGUSR2 that is going
// to activate the devtools agent. You can use any other means to activate
// the agent, not just signal handlers.
process.on('SIGUSR2', function () {
if (agent.server) {
agent.stop();
} else {
agent.start({
port: 9999,
bind_to: '0.0.0.0',
ipc_port: 3333,
verbose: true
});
}
});