DevTools Protocol via require(‘inspector’)
Example: This example implements DevTools Protocol via require(‘inspector’)
const inspector = require('inspector');
const fs = require('fs');
const session = new inspector.Session();
session.connect();
session.post('Profiler.enable');
session.post('Profiler.start');
setTimeout( function() {
session.post('Profiler.stop',
function(err, data) {
fs.writeFileSync('data.cpuprofile',
JSON.stringify(data.profile));
});
}, 8000);
Another awesome thing in using Chrome as a debugging tool is that you can debug both your front-end and back-end JavaScript code with the same interface.
Node Debugging
Debugging is a concept to identify and remove errors from software applications. In this article, we will learn about the technique to debug a Node application.
Table of Content
- Why not to use console.log()?
- How to debug in Node?
- Steps for debugging in Node
- Additional Debugging APIs
- Drive with DevTools Protocol via WS port
- DevTools Protocol via require(‘inspector’)
Contact Us