简体   繁体   中英

see nodejs network requests

As you know in a web application we can see network requests in the browser network tab.

Is there a way to see network requests trigger from a nodejs application? Actually, I'm looking for a tool or a trick to see the network requests of my nodejs application.

I can debug my nodejs application using this:

https://stackoverflow.com/a/68924906/6346785

But I can't see what I want.

The built-in modules in nodejs have some support for debug flags. You set them in the environment variable NODE_DEBUG as in NODE_DEBUG=http and then those modules will output a bunch of information about what they are doing to the debug console.

Some that might be relevant here are:

NODE_DEBUG=http
NODE_DEBUG=net

or both together:

NODE_DEBUG=http,net

I've found that these will not give me the same level of detail about the data being sent and received as the network tab in the browser, but they will give you the general idea of what requests are being made and to whom.


Depending upon your operating system, there are numerous tools (often called packet analyzers) that let you monitor network traffic on a computer across all processes with varying smarts about how much they can parse the protocol to give you a higher level view of what's happening. A couple tools like that are ethereal and wireshark.

While you can ultimately see anything in the network traffic with these tools, my experience is that its often a bunch of learning with them to be able to zoom in on exactly what you're looking for.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM