简体   繁体   English

无法从浏览器调试Node js应用

[英]Not able to debug node js app from browser

I want to debug my node application(via webstorm10 & i've also 9),i've put breakpoint in the required file and edit the run configuration like following (for local debug I want to debug local host...) ,I want to send some post message via postman or fiddler and simply debug it... https://www.jetbrains.com/webstorm/help/running-and-debugging-node-js.html 我想调试我的节点应用程序(通过webstorm10和我也有9个),我已将断点放在所需的文件中,然后编辑运行配置,如下所示(对于本地调试,我想调试本地主机...),我想要通过邮递员或小提琴手发送一些帖子消息并对其进行调试... https://www.jetbrains.com/webstorm/help/running-and-debugging-node-js.html

the issue is that my program is using the following code 问题是我的程序正在使用以下代码

app.set('port', process.env.PORT || 3000);

and when you click on debug(in WS) you get every time new port like 当您在WS中单击debug时,每次都会得到新的端口,例如

Debugger listening on port 59267

what I should do in this case? 在这种情况下我该怎么办?

I wanted to debug the app.get('/aa', function(req, res) { 我想调试app.get('/aa', function(req, res) {

when I put in the browser http://localhost:59267/aa its not stops and I got in the browser the following response: 当我将浏览器放入http://localhost:59267/aa它没有停止,并且在浏览器中得到了以下响应:

Type: connect
V8-Version: 3.28.73
Protocol-Version: 1
Embedding-Host: node v0.12.2
Content-Length: 0

always use process.env.PORT or 3000 in the browser 始终在浏览器中使用process.env.PORT或3000

you can get the actual port like below: 您可以得到如下所示的实际端口:

console.log('Server running at port:' + app.get('port')); 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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