英文:
Inspecting outgoing HTTP requests in a nodejs application
问题
我正在使用NestJS构建一个Web应用程序,从中调用外部API以检索数据。现在,我想检查从我的应用程序发送的所有请求。例如,在Web浏览器中,我可以通过控制台检查我发送到服务器的所有请求。
您能否指导我如何实现这一目标?无论是在Node.js、NestJS中,还是通过使用其他软件。
注意:我正在使用node-fetch进行网络调用。
英文:
I am using NestJS to build a web app from which I call an external API to retrieve data. Now, I want to inspect all the requests that are sent from my app. For example, in a web browser, I can inspect all the requests I send to my server through the console.
Could you please advise on how I can achieve this? Whether it's in Node.js, NestJS, or by using some other software.
NOTE: I am using node-fetch to make network calls.
答案1
得分: 1
-
如果您的服务部署在GCP云运行的任何无服务器平台上,如Cloud Run、Cloud Functions、App Engine,那么控制台日志将被流式传输到日志浏览器。
-
另一种可能的方式是构建您自己的日志流式传输服务或使用Winston日志记录器在文件中创建日志转储。
-
市场上有一些可用工具,如果以所需方式传递数据,它们可以在其仪表板中以表格格式显示日志。易于使用过滤器监视和查询。
英文:
-
If your service is deployed in any serverless platform for GCP cloud run, cloud functions, app engine then console logs will be streamed in log explorers.
-
Other possible way is build your own log streaming service or create log dumps in a file using winston logger.
-
There are few available tools in market for which if u pass your data in a required manner they can show the logs in table format in their dashboard. Easy to monitor and query with filters
答案2
得分: 0
除了记录node-fetch的HTTP调用外,我不认为有内置工具用于发送HTTP请求。
英文:
Outside of logging the node-fetch http calls, I don't believe there is a built-in tool for outgoing http requests.
答案3
得分: -1
我找到了解决方法,有一个工具(httptoolkit)可以检查从任何地方(浏览器、容器、终端等)发送的所有请求。
英文:
I found the solution, there is a tool (httptoolkit) that allows to inspect all the requests that are sent from anywhere (browser, container, terminal ...)
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论