Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialUoptyu Uiyo
511 PointsWhere is the server running?
A server is a physical computer right So where is it? Is it on my local machine and for each new connection/request the server just assigns a new socket to the port and listens on the same port naa ? So why are we killing processes?
I'm all confused Dont knoww much networking
https://teamtreehouse.com/library/build-a-simple-dynamic-site-with-nodejs/creating-a-simple-server-in-nodejs/creating-a-simple-server This is the reference video
2 Answers
Jennifer Nordell
Treehouse TeacherThe server is a physical computer, yes. And in this case, it's your computer. You may have noticed the IP address 127.0.0.1. This is the IP address for what is known as the "local host" meaning your computer. And then we specify what port to run on and listen on. When we then connect to 127.0.0.1 on that port our server will respond.
Later he changes it to a Treehouse server inside the workspace.
We are killing the instance of the server in this example, because he's coded it so that it will run forever and print out the time every 1 second. There is nothing in there that will stop it other than shutting it down. He speaks about this at the end of the video and says that it will be covered later.
As a side note, knowing that 127.0.0.1 can be handy when troubleshooting network cards. If you cannot ping 127.0.0.1, then something is wrong
Uoptyu Uiyo
511 PointsThanks a ton . It helped a lot