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 Creating a Simple Server in Node.js Creating a Simple Server

Alejandro Fidanza
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Alejandro Fidanza
Full Stack JavaScript Techdegree Graduate 24,840 Points

Can I create the server in my computer with nodeJS(S.O LINUX)?, I need use nodeJS and NGINX?..thank you.

I was reading and found this research:

http://stackoverflow.com/questions/5009324/node-js-nginx-what-now

https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-16-04

I want to know if I can run the server in my computer without workspaces, or maybe the security of linux is the problem, but I am trying to do it without going far away from the courses!

1 Answer

Brodey Newman
Brodey Newman
10,962 Points

You can set up a Node development environment using the code below taken from MDN.

This is a great way to stay along with the coursework without using workspaces.

//Load HTTP module
var http = require("http");

//Create HTTP server and listen on port 8000 for requests
http.createServer(function (request, response) {

   // Set the response HTTP header with HTTP status and Content type
   response.writeHead(200, {'Content-Type': 'text/plain'});

   // Send the response body "Hello World"
   response.end('Hello World\n');
}).listen(8000);

// Print URL for accessing server
console.log('Server running at http://127.0.0.1:8000/')