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

gould

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gould

**Gould** is a super simple Node module to display your backend console logs on the frontend console. It works by the following steps:

  • 1.3.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

#Gould

Gould is a super simple Node module to display your backend console logs on the frontend console. It works by the following steps:

  1. Writing the backend logs to a file called 'temp.log'
  2. Establishing a socket connection with the frontend using 'socket.io'
  3. Utilizing the 'fs' module's 'watch' method to watch for every new log message
  4. Utilizing the 'fs' module's 'read' method to get each new log message from 'temp.log'
  5. Piping each of these messages to the front end socket
  6. Console logging the messages once they arrive on the front end

The process is nearly simultaneous.

Setup is easy. On your backend app.js or server.js file, ensure you initialize a server using http:

const server = http.createServer(app);

On the front end of any page where you want simultaneous logging, simply include the following lines, switching out the appropriate localhost port or remote URL as needed:

<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/1.7.2/socket.io.min.js"> </script>
<script type="text/javascript">
    let socket = io.connect('http://localhost:3000');
    socket.on('stuff', function (data) {
      console.log(data);
    });
</script>

That's it. You're done.

Notes: Gould must be required after server instantiated This is for express

FAQs

Package last updated on 17 Jan 2017

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