1 00:00:00,410 --> 00:00:05,456 Debugging a node application with Google Chrome feature was first introduced 2 00:00:05,456 --> 00:00:10,824 in Node.js 6.3+ but wasn't recommended for years until Node.js 6.4+. 3 00:00:10,824 --> 00:00:14,048 You'll also need at least Google Chrome 55+. 4 00:00:14,048 --> 00:00:18,800 The great thing about using Google Chrome as a debugging tool is that you can 5 00:00:18,800 --> 00:00:24,220 debug both your front end and back end java script with the same interface. 6 00:00:24,220 --> 00:00:26,265 You'll see how familiar it looks in a minute. 7 00:00:26,265 --> 00:00:31,640 Open up Google Chrome and visit the experimental dev tool settings panel 8 00:00:31,640 --> 00:00:36,173 by visiting chrome//flags, 9 00:00:36,173 --> 00:00:42,390 hit Enter, and then scroll down to developer tools experiments. 10 00:00:43,960 --> 00:00:49,065 Click enable and then Chrome will ask to restart. 11 00:00:52,562 --> 00:00:54,639 Then open up the developer tools. 12 00:01:03,837 --> 00:01:05,585 Head over to the settings. 13 00:01:05,585 --> 00:01:10,380 This settings menu is hidden under this menu here with the three 14 00:01:10,380 --> 00:01:12,826 dots stacked above each other. 15 00:01:14,492 --> 00:01:16,940 Then go to experiments. 16 00:01:16,940 --> 00:01:19,220 Then the next step is a little strange. 17 00:01:19,220 --> 00:01:21,051 Hit the shift key six times. 18 00:01:24,892 --> 00:01:27,484 You should now see some other options appear. 19 00:01:27,484 --> 00:01:32,860 Including debugging node.js, 20 00:01:32,860 --> 00:01:36,970 check the box next to the text, and then close down the panels. 21 00:01:40,210 --> 00:01:44,400 Chrome is now set up to debug node applications. 22 00:01:44,400 --> 00:01:46,330 Now let's set up the node side. 23 00:01:46,330 --> 00:01:51,200 To put node into debug mode and generate a URL for Chrome to use to inspect your 24 00:01:51,200 --> 00:01:55,632 application you need to pass in the -- inspect flak for 25 00:01:55,632 --> 00:02:00,955 example the command would look like node--Inspect. 26 00:02:00,955 --> 00:02:05,620 App.js if our application was in a file called appjs. 27 00:02:05,620 --> 00:02:08,663 Since we're using MPM to start our application, 28 00:02:08,663 --> 00:02:11,282 we'll need to modify the package.JSON. 29 00:02:13,520 --> 00:02:15,496 And add the inspect flag. 30 00:02:20,451 --> 00:02:25,950 Save the file, And start the application again with MPM start. 31 00:02:27,630 --> 00:02:30,300 You should see a message when the server starts. 32 00:02:30,300 --> 00:02:35,987 To start debugging open up the following URL in Chrome then copy the URL. 33 00:02:38,229 --> 00:02:40,733 And paste it into Google Chrome. 34 00:02:43,778 --> 00:02:47,830 And now you should see a familiar dev tools interface. 35 00:02:47,830 --> 00:02:49,980 I'll cover the debugging features next.