Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done! You have completed Build a Simple Dynamic Site with Node.js!
You have completed Build a Simple Dynamic Site with Node.js!
Preview
The way computers agree to talk to each other is known as a protocol. In this video we'll discuss the protocol that web browsers and web servers use and how this ties into Node.js.
This video doesn't have any notes.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
In this course, we'll be creating a dynamic website. 0:00
So, let's go over a little bit of theory of how websites operate. 0:02
Let's start with the web browser. 0:06
A web browser is an application that is used to download and 0:09
render HTML and CSS and execute any client side JavaScript. 0:12
You type in a website address into a browser's address bar and hit enter, and 0:17
it sends a request for information to a server or 0:21
a computer on the internet that has that domain name assigned to it. 0:25
Part of the information that the server receives in the request is the address or 0:30
the URL that the client has entered. 0:34
A URL will have a path to a file like index.html. 0:37
The software running on the server like Apache or 0:41
NGINX, will be configured to look for a certain directory on the server 0:44
and look for the file, and in turn reads its contents and 0:49
sends it back to the browser. 0:52
The way the browsers and the web server agree to communicate is called a Protocol. 0:55
The Protocol that the browser and 1:01
web servers use is Hypertext Transfer Protocol or HTTP. 1:03
You can refer to the software on the server as an HTTP Server and 1:07
the browser as an HTTP Client. 1:12
Now, what happens when you want a dynamic site, for 1:16
example, if I wanted a PHP script to run on my server? 1:19
The HTTP Server would need to use a PHP Interpreter to 1:23
run the code to generate dynamic content on the page and send it. 1:27
So the question is, how does Node.js fit in? 1:32
Well, with Node.js you can actually create your own HTTP server programmatically. 1:35
Handling URLs, and requests, and responding however you want. 1:41
You can serve static files or generate dynamic content. 1:46
It's all up to you. 1:50
And that's what we'll be doing in this course. 1:51
Creating an HTTP server, serving files, and 1:53
generating dynamic content all in Node.js. 1:57
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up