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 trial

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/')