Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-monkey

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-monkey

A Node.js module for inspecting and debugging Node applications through a web browser

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
39
increased by21.88%
Maintainers
1
Weekly downloads
 
Created
Source

node-monkey

A Node.js module for inspecting and debugging Node applications through a web browser

node-monkey runs a simple server and uses Socket.IO to create a websocket connection between the browser and server. It captures anything that would normally be logged to the terminal, converts it to JSON and passes it to the browser where it can be logged in the console for inspection.

The motivation for this project came from trying to debug a Node server I wrote that used websockets. I found it problematic trying to inspect objects with the terminal. I tried using the built-in debugging that works with the Chrome Developer Tools plugin for Eclipse. Unfortunately, I ran into a problem where setting breakpoints to inspect objects would cause the server to stop responding to heartbeats and cause the client to disconnect. This would entirely mess up my debugging efforts. All I really needed to do was have a good way to inspect objects. I searched Google and found projects like node-inspector, which doesn't work with the latest versions of Node, and node-codein which has many bugs. And neither works with Firefox. And node-monkey was born!

Installation

npm install node-monkey

Usage

Using node-monkey is extremely easy. All you have to do is include the following line in your Node.js application. Anything that is logged to the console after this will show up in the browser console once connected. It captures all output to console.log(), console.warn() and console.error().

require('node-monkey').start([options]);

To connect your browser simply go to http://0.0.0.0:5678 in your web browser. If you change the default host and port bindings be sure to adjust your URL accordingly.

Options

  • host: The host network interface to bind to. Default is 0.0.0.0 which means ALL interfaces.
  • port: The port to listen on. Default is 5678.
  • suppressOutput: Use this to suppress terminal output when console.log() is called, freeing the console from clutter and allowing you to only inspect objects through the browser. Default is true.
  • saveOutput: If data is logged before you are able to connect your browser, you may still want to be able to view this data. Setting this option to true causes node-monkey to save the output and dump it out to the browser once you connect. Default is true.

Examples

Example 1

require('node-monkey').start();
console.log('It works!', {key1: 'test', key2: ['an', 'array']});

Example 2

require('node-monkey').start({
  suppressOutput: false
});

console.log('It works!');
console.warn('You might have done something wrong');
console.error('FATAL ERROR', {message: 'Something broke'});

Contribute

I welcome any pull requests, feature suggestions, bug fixes and bug reports. Let me know what you think.

LICENSE - "MIT License"

Copyright (c) 2012 Justin Warkentin

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Keywords

FAQs

Package last updated on 17 Oct 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc