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

amadeo brands
amadeo brands
15,375 Points

Completed my first Node JS application ... but how can I run it on my website and share it with the world :D

I have completed my first Node JS application ... but how can I run it on my server? See here the URL where I placed my files: My application

See here my app.js file ... How can I get this to work on my website?

var router = require("./router.js");

const http = require('http');
http.createServer(function (request, response) {
  router.home(request, response);
  router.user(request, response);
}).listen(8080);
console.log('Server running at http://<workspace-url>/'); 

Thank you all :)

2 Answers

Matt F.
Matt F.
9,518 Points

Hi Amadeo,

Are you hosting it on your own server, or are you paying a host? If a host, which one?

amadeo brands
amadeo brands
15,375 Points

Hi Matt, I host it on my own server its a VPS I use with multiple websites. Think I need to install some node.js but no idea where to start.

Matt F.
Matt F.
9,518 Points

Hi Amadoo,

A lot of it will depend on the OS of your VPS. Here is a tutorial for Ubuntu:

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