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

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,253 Points

Deploying Node.js website to a server!

Hi all.

I hope everyone has had a great Christmas and all the best wishes for the year ahead.

My learning focus has recently shifted to node.js, which I've done before but I'm trying to add some Node projects to my portfolio.

When I last did the Dynamic Website project, which I accept was some time ago I was so sure that I was able to access it via a location in my server. So I must have been able to upload it via FTP, right?

Yet I can't find a single instruction or walkthrough that allows me to do it. So I must have been mistaken. Or got lucky in some way.

What is an easy way to a website made in Node to a web server? Is there an npm package that can do it? Maybe an equivalent of Create React App for node I haven't heard of?

I want to develop node projects but it'd be much better use if I can serve it somewhere preferably on my own server.

1 Answer

Hello, I think in order to do that your server/platform should have NodeJS installed if you're using Ubuntu as an OS, maybe you can follow this article https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-18-04

In case it's not mentioned in the article, after deploying enables the UFW firewall to allow only SSH (port 22, rate limited), HTTP (port 80), and HTTPS (port 443) access.

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 91,253 Points

Thanks Mehdi,

Having accepted there's no other method of doing it, I managed to set up a droplet on DigitalOcean but the recommended public link for it isn't working. I think one reason for this is I need to set up an NPM project for it but it looks like I've done everything else right.

I'll get there in the end, I think.