Skip to content
Advertisement

Getting Console Messages on Webpage NodeJS

I’m wondering if there’s any way to listen for console messages and act on console messages when they’re received. Mainly, is there any way to do this without an external module, and using the http module?

The goal is to trigger a NodeJS function or code snippet on an event like click in the HTML. If there’s also a way to do this, then that’s great. But once again, I’d like to do this without an external module, and just use those that are built-in to NodeJS.

Advertisement

Answer

Use onclick() function in JavaScript to trigger a function call when clicking on a element. Then use fetch to make a api call to the nodejs server.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement