Don't know! VSCode is pretty powerful, but its interface and feature-set aren't developed by the Chrome DevTools team, so I can't speak to its capabilities. :)
HI Paul , I am trying to debug the application (Node : 9.3.0) Before I debug I followed this step 1)killall node (To kill any existing processes) 2)Then runnode --inspect-brk app.js 3) And in app.js I have the express router as below const users = require('./routes/users'); app.use('/users', users); 4) And in the users.js I have below code router.get('/profile', (req, res, next) => { res.send("User Profile"); }); when set the breaking point at router.get('/profile) line And start the debugging chrome tool the page loads directly with even waiting for debugging, Can you please help here
Mahesh Gadagi I'm assuming you are placing this breakpoint right at the beginning, when devtools first opened and paused? If so, you should pause on the router.get early before the page is requested. A breakpoint on the line below (res.send()) should hit at the actual page request.
Thanks Paul for the response, When I tried to have a breakpoint on the line res.send I'm getting the below error immediately in the console,tough I killed all the node processed and started the new session events.js:136 throw er; // Unhandled 'error' event ^ Uncaught Error: listen EADDRINUSE :::3000 at Object._errnoException (util.js:999:13) at _exceptionWithHostPort (util.js:1020:20) at Server.setupListenHandle [as _listen2] (net.js:1379:14) at listenInCluster (net.js:1420:12) at Server.listen (net.js:1508:7)
Now I understand why even though people hate Java, it still is popular and still relevant. I dont need to go through all this setup just to debug. In Eclipse, Intellij or STS, debugging a java program works out of the box. Why is it so hard to do the same in nodejs?
blasttrash Node doesn't have an actual ide with proper debugging like VS2019 or eclipse is for c# and Java. It's a dynamic language made for scripting simple website interactions, not making real programs. People are basically misusing JS but it's so popular that the crazy optimized runtimes and tools and libraries have made it usable. The reason nodejs is popular is because webdevs learn JS then don't want to learn a real language for native programs.
@@YoloMonstaaa I know that. And being a statically typed language means that Java and C# have advantage when it comes to IDE or intellisense etc at the cost of some verbosity.
blasttrash I disagree. I don't think string int or char is more verbose than let and bar. What makes c# code verbose is oop and scope rules, nothing to do with static types.
@@YoloMonstaaa no I dont think so AbstractFactorySpringBeanInitializer abstractFactory = new AbstractFactorySpringBeanInitializer(); with dynamic typed language, you can at least skip the first part. Now scale this to entire code base. Without IDEs or code scaffolding, it'd be a pain to type all this. Thats why for quick prototyping or simple scripting, people use js or python or even groovy. In fact some codebases in java use groovy(spock etc) to write tests since tests are not that business critical hence can be written faster. Note groovy is whats called as optionally typed according to some people. Of course there is a huge gray area in that definition.
@@blasttrash Well no, since C# 3.0 (from ~2007) you can have implicitly assigned static typed variables in that situation, so your example would look like var abstractFactory = AbstractFactorySpringBeanInitializer(); And C# will automatically assign it the right type. It's still statically typed so you have all the advantages from that. I'm sure Java has an alternative, I just happen to use C#. It's actually best practice to use var in C# and styling tools (resharper) actually enforce it. So I think my point stands :) Edit- quick Google shows Java also has var keyword added in Java 10 in 2018. Man y'all have been slow to copy C# (11 years! Lol). So we can say that's been a limitation of Java and not because of statically typed programming.
Hey Paul, You're the most interesting and charismatic developer I've ever seen. I've been watching you since 2010. But today is 2017 and you're still speaking about nodejs. Seriously? Machine Learning, Solidity, Blockchain development are not enough interested for you? what's wrong with you, man? :)
No man, ML rocks. Once you are interested in knives, then you go hunting. Paul is still talking about how knives are produced from, instead of catching a bear with that knife.
Maybe I should not answer you because you really look like a troll and I feel I am wasting my time but not sure enough: I guess you don't deserve a knife if you don't respect the ones that craft them and teach you how to use them properly. Enjoy your bear hunting but let mature people help the others.
Anytime I'm bored, I watch this. My heart flutters and levitates everytime.
"What is beyond the console.log()". That last phrase cracked me up. Also, great presentation Paul. Thanks for sharing!
Fun Facts: The first known computer bug was a real bug (an insect) stuck in the electronics.
Awesome tutorial
Blackbox is really stunning!
Awesome video Paul. Is it posible to have access to all these features if I debug inside vscode?
Don't know! VSCode is pretty powerful, but its interface and feature-set aren't developed by the Chrome DevTools team, so I can't speak to its capabilities. :)
wow this video is so imformative for me thank you for sharing
Good stuff. I think it will help me get out of the cocoon of the VS Code Debugging Tool. :)
Zubair Ahmed how is the chrome one better?
Awesome lecture. Thanks Paul Irish.
Hi friend very nice informative video
Did they decide to scrape the BlackBox feature, because I can't find it.
how to restart "node server.js" from DevTools, is it possible?
great video thanks.
Where is "Network" tab?
Can you come to my house and do this for me. Every time I click on show more it doesn't work, really scratching my head over this. Please help.
HI Paul , I am trying to debug the application (Node : 9.3.0)
Before I debug I followed this step
1)killall node (To kill any existing processes)
2)Then runnode --inspect-brk app.js
3) And in app.js I have the express router as below
const users = require('./routes/users');
app.use('/users', users);
4) And in the users.js I have below code
router.get('/profile', (req, res, next) => {
res.send("User Profile");
});
when set the breaking point at router.get('/profile) line And start the debugging chrome tool the page loads directly with even waiting for debugging, Can you please help here
Mahesh Gadagi I'm assuming you are placing this breakpoint right at the beginning, when devtools first opened and paused? If so, you should pause on the router.get early before the page is requested. A breakpoint on the line below (res.send()) should hit at the actual page request.
Thanks Paul for the response,
When I tried to have a breakpoint on the line res.send I'm getting the below error immediately in the console,tough I killed all the node processed and started the new session
events.js:136
throw er; // Unhandled 'error' event
^
Uncaught Error: listen EADDRINUSE :::3000
at Object._errnoException (util.js:999:13)
at _exceptionWithHostPort (util.js:1020:20)
at Server.setupListenHandle [as _listen2] (net.js:1379:14)
at listenInCluster (net.js:1420:12)
at Server.listen (net.js:1508:7)
Now I understand why even though people hate Java, it still is popular and still relevant. I dont need to go through all this setup just to debug. In Eclipse, Intellij or STS, debugging a java program works out of the box. Why is it so hard to do the same in nodejs?
blasttrash Node doesn't have an actual ide with proper debugging like VS2019 or eclipse is for c# and Java. It's a dynamic language made for scripting simple website interactions, not making real programs. People are basically misusing JS but it's so popular that the crazy optimized runtimes and tools and libraries have made it usable. The reason nodejs is popular is because webdevs learn JS then don't want to learn a real language for native programs.
@@YoloMonstaaa I know that. And being a statically typed language means that Java and C# have advantage when it comes to IDE or intellisense etc at the cost of some verbosity.
blasttrash I disagree. I don't think string int or char is more verbose than let and bar. What makes c# code verbose is oop and scope rules, nothing to do with static types.
@@YoloMonstaaa
no I dont think so
AbstractFactorySpringBeanInitializer abstractFactory = new AbstractFactorySpringBeanInitializer();
with dynamic typed language, you can at least skip the first part. Now scale this to entire code base. Without IDEs or code scaffolding, it'd be a pain to type all this. Thats why for quick prototyping or simple scripting, people use js or python or even groovy. In fact some codebases in java use groovy(spock etc) to write tests since tests are not that business critical hence can be written faster. Note groovy is whats called as optionally typed according to some people. Of course there is a huge gray area in that definition.
@@blasttrash Well no, since C# 3.0 (from ~2007) you can have implicitly assigned static typed variables in that situation, so your example would look like
var abstractFactory = AbstractFactorySpringBeanInitializer();
And C# will automatically assign it the right type. It's still statically typed so you have all the advantages from that. I'm sure Java has an alternative, I just happen to use C#. It's actually best practice to use var in C# and styling tools (resharper) actually enforce it. So I think my point stands :)
Edit- quick Google shows Java also has var keyword added in Java 10 in 2018. Man y'all have been slow to copy C# (11 years! Lol). So we can say that's been a limitation of Java and not because of statically typed programming.
Great work with this. If anyone wants to checkout more tools to debug and profile NodeJs , please follow this article.
Hey Paul,
You're the most interesting and charismatic developer I've ever seen. I've been watching you since 2010. But today is 2017 and you're still speaking about nodejs. Seriously? Machine Learning, Solidity, Blockchain development are not enough interested for you?
what's wrong with you, man? :)
Hahaha, nice question.
Need a reply though :D
Node rocks dude. And you can even use it for things like machine learning or blockchain. Food 4 thought
No man, ML rocks. Once you are interested in knives, then you go hunting. Paul is still talking about how knives are produced from, instead of catching a bear with that knife.
I guess some people are more interested in producing better knives than the hunting part ;).. just a personal preference?
Maybe I should not answer you because you really look like a troll and I feel I am wasting my time but not sure enough:
I guess you don't deserve a knife if you don't respect the ones that craft them and teach you how to use them properly. Enjoy your bear hunting but let mature people help the others.