Week 8 – Node.js

To start, the goal is to get the simplest of simple node applications working on my local host. I followed the steps to create a project directory and install express.

I tried to build off of the simpleServer example from class that would receive a query with a name and respond with a string of “Hello + name”. I ran into a few errors — mostly incorrect lines in my code or a misspelling — and eventually I corrected all the errors and was able to access my localhost and get a response.

Next, I tried to make it a bit more ‘complex’ … complex is a strong word … I just wanted to have more than one parameter in a route. I found an example online and followed that.

I continued to play around and create another simple application going off of the one done in class.

Next, I’d like to link everything so that I can access the nodejs application through my site. I first started my creatinga repository on my github so that I could clone it in my server. And eventually use PM2 to run the application constantly.

I used the guide “How to Setup A NodeJs Application

Update, I’m not sure what I’m missing in order to get a nodejs app working through my site instead of just accessing through the localhost … I have my git repo cloned inside /var/www/biancasbread.com/ (but I’m not sure if that’s correct), I’ve also used PM2 to run the basic app constantly, but whenever I type in http://www.biancasbread.com/bread in my browser, instead of getting the response it get a ‘ Cannot GET /bread ‘ error.

I also have a proxy_pass setup for the location /bread at http://localhost:8080 — is this correct?

I used this guide to configure the reverse proxy

Update, not sure what I did, but it seems to be working!


Leave a comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: