0

I want to use the browser as a "2nd Console" for debugging purposes. My plan is to use the main console for the technical stuff and to use the browser to output App related data. Eventually I will pretty it all up, but for now, I just want to have it up and running.

So here is my quick and sloppy code:

    const express = require('express')
const app = express()
var test;
app.all('/', (req, res) => res.send(test));
app.listen(3000, () => console.log('Example app listening on port 3000!'))

That's it, I just change the test var to whatever I want to show, it was working well for a while, but I'm getting to the point where there is a lot of data I want to show and it's getting sloppy.

I'd love to hear some suggestions.

1
  • i don't see a question here. This is not a website for suggestions. Please define your problem properly Commented Apr 12, 2018 at 23:55

1 Answer 1

3

Node features a debugger. To have a look into the internals of your app, why not use the debugger?

Start your node app with:

node --inspect server.js

This will give you websocket url (localhost by default) you can connect to.

Open chrome://inspect in a Chromium-based browser. Click the Configure button and ensure your target host and port are listed.

As an advantage: You will see ALL variables you have. There are other IDEs that are supported as well (including VS and VS Code).

For detailed instructions, more command line switches and setup the Inspector Interface see the Debugging Guide

Sign up to request clarification or add additional context in comments.

1 Comment

WOW! Cool! Thank you!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.