Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript Build a Simple Dynamic Site with Node.js Handling Routes in Node.js User Route

Is this video / module deprecated?

I see most questions from few years ago and the Node code is different on webpage?

  • Is there point to follow it to the details or rather just to get the big picture?

2 Answers

Lee Vaughn
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree seal-36
Lee Vaughn
Treehouse Teacher

Hi Siim Kustassoo!

Did you have any problem coding along with the lesson? Not quite sure what you mean by the Node code on the page looking different but when I download the project files for this point in the lesson and run them it seems to work fine.

If you continue to have trouble please share some more details as to the specific problem(s) you are running into along with either a Snapshot of your Workspace (the camera icon towards the top right) or a link to a GitHub repo so that we can see and test your code.

Thanks!

Hi. My question was regarding the node syntax. This whole video is based on the syntax shown/copied from Node.js webpage. Visiting at this time the server creation syntax is different and has some specifics that do not seem to match with what is going on in the video.

Ex: res.writeHead(); in the video vs res.setHeader(); and res.statusCode(); from the current node.js webpage.

I would like not to learn some fundamentally old syntax that I need to soon relearn. My question is that, is it still valid to learn everything from these videos detail by detail or rather just to grasp the bigger picture.

Lee Vaughn
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree seal-36
Lee Vaughn
Treehouse Teacher

Hi Siim Kustassoo!

Code is ever-evolving so there are frequent new methods or new approaches added. Unless something is specifically depreciated this typically means that you simply have more options for how to do things. There can also be subtle differences so two things that might seem the same might actually be slightly different or serve slightly different purposes.

writeHead() vs setHeader() is a good example of this. You can check out the answer to this question for a nice breakdown of the small difference between these two: https://stackoverflow.com/questions/28094192/difference-between-response-setheader-and-response-writehead

It doesn't appear that any of the methods/approaches shown in this course are depreciated and the code all seems to work as expected so it is all still great stuff to learn. :thumbsup: