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 trialevanritscher
10,209 PointsIs hosting a webapp different from hosting a standard site?
I'm working through some of the JavaScript courses on Nodejs, express etc. though I imagine this question applies to python, php and other backend languages.
I can create an html site with all the front-end styling and JavaScript interactivity I want and send that over an FTP to my site.
But if I were to create a more involved web app with routes, programmatic data etc. as Nodejs seems to allow you to do, would I be hosting this in the same way?
If I wanted to use jQuery in my site, I would simply reference it in the head tag. Do I reference Node in some similar way? I've downloaded the packages to my local machine but what about my "machine" that is part of my host's shared hosting platform?
Do I need a different place to host a given project like AWS?
1 Answer
Seth Kroger
56,413 PointsThe answer to this question will vary greatly depending on your hosting company and the packages they provide.
Fundamentally, hosting a webapp is different from a static site because the webapp needs addtional resources in server memory and processor time for the app and the database in addition to those needed for serving the HTML/CSS/JS of a static site. However many web hosts include some back-ends in their standard packages (usually PHP but can include others). There are other options for hosting like Heroku and AWS.
Servers supporting node should already have it installed and ready to run. It's just a matter of configuring your webapp for the particular host so the host automatically runs your script with node. (Instructions will vary between hosts).
For Heroku, check out this Treehouse Workshop: https://teamtreehouse.com/library/deploy-a-node-application-to-heroku
evanritscher
10,209 PointsGotcha - Currently I use SiteGround which as shared hosting I think might be limited in what dedicated processing/memory I can claim. I'm still somewhat confused though and maybe this is something that you learn by doing but what is the general process for linking your web app to a domain. For instance, if I have example.com and it's hosted on SiteGround, how would you describe the general process of having example.com/greatwebapp link to the app hosted on Heroku?
Ethan Weeks
15,352 PointsEthan Weeks
15,352 PointsYou are definitely on the right track. I can only speak from an AWS EC2 stand point because that's what I am hosting with but it is exactly as you describe, just more configuration. When you use a service like AWS EC2 amazon is essentially giving a computer with nothing on it (aka. your server). So you'll have to download an OS and nodejs and get your project on it... npm install. Then spin up a server just like nodemon or node app.js but something that will start back up if your server were to crash. forever.js That is a very very short simple description. AWS is a lot of fun to play with and offers a lot of services but there can be a lot of configuration involved. I would suggest for hosting your first web application that you follow a popular tutorial on AWS or host with something like Heroku which is built on AWS but has abstracted a lot of the configuration. It is still a good learning experience but much easier to deploy and maintain. AWS is huge and you'll probably get a bunch of different answers to solve the same problem but in my bias opinion EC2 with Ubuntu is a great place to start.