1 00:00:00,270 --> 00:00:02,840 In this course, we'll be creating a dynamic website. 2 00:00:02,840 --> 00:00:06,710 So, let's go over a little bit of theory of how websites operate. 3 00:00:06,710 --> 00:00:09,100 Let's start with the web browser. 4 00:00:09,100 --> 00:00:12,390 A web browser is an application that is used to download and 5 00:00:12,390 --> 00:00:17,470 render HTML and CSS and execute any client side JavaScript. 6 00:00:17,470 --> 00:00:21,980 You type in a website address into a browser's address bar and hit enter, and 7 00:00:21,980 --> 00:00:25,530 it sends a request for information to a server or 8 00:00:25,530 --> 00:00:30,010 a computer on the internet that has that domain name assigned to it. 9 00:00:30,010 --> 00:00:34,440 Part of the information that the server receives in the request is the address or 10 00:00:34,440 --> 00:00:37,640 the URL that the client has entered. 11 00:00:37,640 --> 00:00:41,240 A URL will have a path to a file like index.html. 12 00:00:41,240 --> 00:00:44,850 The software running on the server like Apache or 13 00:00:44,850 --> 00:00:49,420 NGINX, will be configured to look for a certain directory on the server 14 00:00:49,420 --> 00:00:52,880 and look for the file, and in turn reads its contents and 15 00:00:52,880 --> 00:00:55,520 sends it back to the browser. 16 00:00:55,520 --> 00:01:01,200 The way the browsers and the web server agree to communicate is called a Protocol. 17 00:01:01,200 --> 00:01:03,270 The Protocol that the browser and 18 00:01:03,270 --> 00:01:07,750 web servers use is Hypertext Transfer Protocol or HTTP. 19 00:01:07,750 --> 00:01:12,990 You can refer to the software on the server as an HTTP Server and 20 00:01:12,990 --> 00:01:16,350 the browser as an HTTP Client. 21 00:01:16,350 --> 00:01:19,350 Now, what happens when you want a dynamic site, for 22 00:01:19,350 --> 00:01:23,680 example, if I wanted a PHP script to run on my server? 23 00:01:23,680 --> 00:01:27,730 The HTTP Server would need to use a PHP Interpreter to 24 00:01:27,730 --> 00:01:32,510 run the code to generate dynamic content on the page and send it. 25 00:01:32,510 --> 00:01:35,560 So the question is, how does Node.js fit in? 26 00:01:35,560 --> 00:01:41,240 Well, with Node.js you can actually create your own HTTP server programmatically. 27 00:01:41,240 --> 00:01:45,870 Handling URLs, and requests, and responding however you want. 28 00:01:46,950 --> 00:01:50,170 You can serve static files or generate dynamic content. 29 00:01:50,170 --> 00:01:51,540 It's all up to you. 30 00:01:51,540 --> 00:01:53,920 And that's what we'll be doing in this course. 31 00:01:53,920 --> 00:01:57,500 Creating an HTTP server, serving files, and 32 00:01:57,500 --> 00:02:01,119 generating dynamic content all in Node.js.