WEBVTT 0 00:00.580 --> 00:06.240 So we now know why we need a backend in order to create a web application. 1 00:06.400 --> 00:10.290 But which technology are we going to use to create it? 2 00:10.690 --> 00:18.880 Well, we've actually got quite a few options. You could use Java, Ruby on Rails, PHP, ASP.Net, Node.js, 3 00:18.880 --> 00:21.940 Python, and a whole load more. 4 00:22.020 --> 00:27.660 But in this course we're going to choose Node.js. Now why Node.js? 5 00:27.760 --> 00:34.930 Well, the most important thing is that we already know Javascript, and Node.js allows us to create a 6 00:35.020 --> 00:43.630 backend using Javascript. So we can use one language and we don't have to spend a lot of extra time learning 7 00:43.660 --> 00:46.980 about yet another language and all of its intricacies. 8 00:46.990 --> 00:53.020 We already know how to use Javascript. Now, in addition to that, Node is also superfast and will allow 9 00:53.020 --> 00:59.140 us to create really scalable and fast running web sites. And we're not the only ones choosing Node. 10 00:59.170 --> 01:01.520 We're in really good company here. 11 01:01.660 --> 01:10.090 Web sites such as eBay, Uber, Trello, Twitter, Netflix, all use Node.js in their backend, and more and more 12 01:10.090 --> 01:13.800 companies are joining their ranks and starting to use Node. 13 01:13.810 --> 01:19.440 Now in the last few years, if you've been to any technical conferences, you'll hear Node Node Node Node Node 14 01:19.480 --> 01:24.850 all day long, and there's a lot of people who are super excited about this technology. 15 01:25.000 --> 01:29.940 And in the coming lessons you're going to see exactly why and how awesome it can be. 16 01:30.130 --> 01:35.860 So we've talked about why we want to use Node. But what exactly does it do anyways? 17 01:35.860 --> 01:42.340 Well currently, in our web sites, we've written Javascript code, and we've been able to execute it inside 18 01:42.460 --> 01:43.500 our browser. 19 01:43.810 --> 01:45.650 Now that's really really important. 20 01:45.820 --> 01:54.730 But up until now, that Javascript code has been locked behind bars and kept inside the browser, so it's 21 01:54.850 --> 02:00.970 only been able to interact with the browser, request information from the browser, add event listeners 22 02:00.970 --> 02:02.800 to components in the browser, 23 02:02.890 --> 02:09.220 but we've not been able to write Javscript code for our web site that's able to go beyond the boundaries 24 02:09.430 --> 02:10.330 of the browser. 25 02:10.360 --> 02:16.690 For example, our code isn't able to reach out of the browser into the user's computer and get access 26 02:16.690 --> 02:21.050 to, for example, the file system, or the networking processes. 27 02:21.220 --> 02:22.870 And there's a very good reason for that. 28 02:22.870 --> 02:27.910 You don't want to load up a web site that's written by some random person with a whole load of Javascript 29 02:27.910 --> 02:28.240 on it 30 02:28.240 --> 02:34.950 that’s got malicious code: bugs, viruses, hackers who are trying to tap into your local file system. 31 02:35.120 --> 02:39.870 It’d be really really dangerous if they could download or look into your local files, 32 02:39.880 --> 02:40.390 right? 33 02:40.600 --> 02:46.960 But there are some situations where, for example, if you were to build a desktop application, like Atom, 34 02:47.170 --> 02:52.420 then you do need to access the file system in order to load up those code files that the user is going 35 02:52.420 --> 02:52.880 to edit, 36 02:52.900 --> 02:53.650 right? 37 02:53.710 --> 03:00.480 And in these situations, you need to be able to access the file system, or listen to the network request. 38 03:00.640 --> 03:07.390 Basically you need to be able to write code that can interact directly with the computer, independent 39 03:07.480 --> 03:08.670 of the browser. 40 03:09.160 --> 03:12.410 And that's exactly what Node.js allows us to do. 41 03:12.430 --> 03:20.830 It allows us to take Javascript out of the browser and it liberates it, allowing it to interact directly 42 03:20.860 --> 03:23.140 with the hardware of a computer. 43 03:23.200 --> 03:29.380 So we can now use Javascript inside our web site in order to give it functionality and behavior, 44 03:29.470 --> 03:38.470 for example implementing animations, or dropdown menus. But Node.js allows us to use Javascript to interact 45 03:38.470 --> 03:44.890 directly with the hardware of the computer. So we can use it, for example, to create a desktop application. 46 03:45.220 --> 03:52.010 And in fact, Atom, the code editor that we've been using all of this time, is based on Node.js. 47 03:52.030 --> 03:57.580 So now, with Node.js, you can write Javascript code not just in the browser to affect the behavior of 48 03:57.580 --> 04:03.720 your web sites, but also to write full applications that work on your computer. 49 04:03.970 --> 04:09.670 All right. So some of you guys might think, “Well, fair enough. So you can use Node.js to program desktop 50 04:09.670 --> 04:10.860 applications. 51 04:10.900 --> 04:12.250 Why is that interesting to me? 52 04:12.250 --> 04:14.510 We're learning how to make web sites, right?” 53 04:14.760 --> 04:22.600 Well, we can run Node.js on our own computer, but we could also use Node.js to run Javascript code on 54 04:22.600 --> 04:24.370 somebody else's computer, 55 04:24.520 --> 04:26.380 or rather, a server. 56 04:26.530 --> 04:32.560 And what that means is that a user could log on to Google and put in a query, and your browser will make 57 04:32.560 --> 04:41.530 a request to Google servers, and on those servers we can actually execute Javascript code to process 58 04:41.650 --> 04:43.070 their request. 59 04:43.330 --> 04:49.660 And after that's done, we can send back the result to the user, or to the client, and simply get their 60 04:49.660 --> 04:57.130 web browser to display the information, and all of that heavy lifting, the code execution, happens behind 61 04:57.130 --> 04:59.580 the scenes, on the server, 62 05:00.060 --> 05:01.310 rather than on the client side, 63 05:01.500 --> 05:04.660 and that will make your web site a lot more capable. 64 05:04.680 --> 05:11.250 So in the coming lessons we're going to be using Node.js to interact directly with the computer in 65 05:11.250 --> 05:16.870 order to access local files or listen to network traffic and manipulate databases. 66 05:16.890 --> 05:19.440 So I hope you're looking forward to it. In the next lesson 67 05:19.440 --> 05:25.530 we’re going to get started installing Node, so make sure you check the lesson title for the correct lesson 68 05:25.530 --> 05:26.480 that you should follow, 69 05:26.610 --> 05:28.770 because one of them is for PC users, 70 05:28.820 --> 05:30.900 and another one is for Mac users. 71 05:30.900 --> 05:36.210 So, once you're done with the installation, we’ll get back on to coding and creating web sites and seeing 72 05:36.210 --> 05:38.950 what we can do with this fantastic piece of technology.