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 trialSaud Tauqeer
Courses Plus Student 8,099 Pointsa lot of this feels outdated and different from the current documentation.
is there any other substitute course that has same contents as this course. i have been taking the full stack js course and now i look at the node.js documentation and this video feels outdated. as i started from scratch to learn here i kinda feel lost because of this. should i consider buying courses from some other source or youtube for node.js or server side/building dynamic website. or is there any other way i can go around it or idk.. if i had programming experiences before im sure i would have been able to go thru but as this is all new for me im having issues..
4 Answers
lauralouise
14,853 Pointsconst http = require('http');
// const hostname = '127.0.0.1';
const port = 3000;
const server = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.end('Hello World\n');
});
server.listen(port, () => {
console.log(`Server running at http://treehouse-server:${port}/`);
});```
this is the code for this action taken from Node website on September 12, 2018. basically the same, only a different port, and variables are declared before the function, and the .listen method is not tacked on to the variable declaration. You should be able to use this. This should work!
Schaffer Robichaux
21,729 PointsHi Saud,
I had some initial confusion as well when copying the server set up code from the nodejs.org site ( https://nodejs.org/en/about/ ) into my workspace. The main difference between the content currently on the site and what Andrew is presenting is the usage of ECMAScript 2015/6 and nodejs.org making the code a bit more abstract by declaring constants for hostname and port.
After identifying those changes and tracking the declared constants to their method calls, you should be able to copy what Andrew is doing without much trouble. I recently completed the node.js portions of the full stack track and can honestly say that, despite it not having ECMAScript 2015 syntax, the remainder of the course is very enjoyable and current.
Hope that helps and please reach out if you get stuck
Saud Tauqeer
Courses Plus Student 8,099 PointsYour answer helps a lot thanks mate
Anthony Ngene
13,557 PointsHey Saud, regarding your P.s; ps -aux wont work,
try ps aux
instead.
Saud Tauqeer
Courses Plus Student 8,099 PointsIm currently on phone ill let you know when i try it. Thanks mate
Saud Tauqeer
Courses Plus Student 8,099 Pointsits not working..
Saud Tauqeer
Courses Plus Student 8,099 Pointscan anyone help me setting up node on my local machine i think it would give me a lot more practice and way to experiment.