0.0.3 • Published 8 years ago

delay-debug v0.0.3

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

Delay Debug

It starts node-inspector for you, and it does so until your app is running. It uses node-inspector as a dependency to inspect your app

Why?

  • Node inspector is a bit slow to start, and sometimes it is to complicated to be thinking of how to activate it when using tools like nodemon.
  • This provides a default configuration for nodeinspector with preload disabled for faster start
  • Not having to wait for node inspector in order to start your app allows you to restart the app with frequency (like nodemon reloading after a change), yet you will still be able to add breakpoints as needed if things start acting funky on your app

Installation

npm install delay-debug

Using

On your main app file (index.js)

// Your code. E.g. Like starting an http server or a service
require('http')
  .createServer(function(req, res){
    console.info('Request received: ' + req.url);
    res.end('It Works!! Path Hit: ' + req.url);
  })
  .listen(8080, function(){ console.log("Server listening on: http://localhost:%s", 8080); })
;


// Start the inspector until now
var inspector = require('delay-debug');
inspector();

From the command line start your app, make sure to include --delaydebug flag

node index.js --delaydebug

Follow the instructions on the output. Sometimes you might need to use the pause button on the debugger and then continue in order to allow the server process to continue

Configuration

You can pass a different configurations for nodeinspector by providing an object

var inspector = require('delay-debug');
inspector({
  delaydebug: {} // Normally what would go in a .node-inspectorrc
});

Pairs well with conf-stack project

var
  inspector  = require('delay-debug');
  ,confStack = require('conf-stack')
  ,config    = confStack()
;
inpector(config);
``