Proxy that reroutes API requests from two service-oriented architecture modules and displays bundles and data for both apps on the same page. Made with Express and Node js. Can run locally or be deployed using Amazon EC2 & S3 services.
Before setting up proxy locally, complete local setup for Reviews and Carousel services.
git clone
- install dependencies with
npm install
- in
public/index.html
, make sure bothlocalhost
script tags are active, ands3
bundle scripts are commented out - in
server/index.js
, make sure bothlocalhost
middleware routes are active, and EC2 routes are commented out. - start server with
npm run start
- verify app up and running at
localhost:3000/rooms/:id
(for id values 0-99)
Before setting up proxy on EC2, complete EC2 setup for Reviews and Carousel services.
- after both services are up and running, upload each service bundle (located at
client/dist/bundle.js
) to an Amazon S3 bucket, giving each bundle a unique name - in each upload's "Object Actions" menu, select "Make Public"
Before creating a new EC2 instance for the proxy, edit locally first:
git clone
proxy repo- install dependencies with
npm install
- in
public/index.html
, make sure boths3
script tags are active, andlocalhost
bundle scripts are commented out, and update both S3script src
urls with uploaded bundle urls from step #1 - in
server/index.js
, make sure both EC2 middleware routes are active, andlocalhost
routes are commented out, and update both EC2 service routes' IPv4 addresses - start server with
npm run start
- verify proxy displays both services at
localhost:3000/rooms/:id
(for id values 0-99)
After local proxy displays S3 bundles populated with service EC2 data, create a new instance for the proxy:
- create and launch EC2 instance with Ubuntu AMI on t2 micro (or preferred settings)
- edit Instance Inbound Rules by adding "All Traffic" from "Anywhere," or preferred security settings
- add pem key to root and .gitignore, and in Terminal make pem private with
chmod 400 [.pem file]
- connect to instance with
ssh -i "[pemKeyName].pem" ubuntu@[Public IPv4 DNS]
NOTE: Public IPv4 address will change every time instance shuts down. To avoid repeated IP changes during development, restart instance instead of shutting down. - install Node on Ubuntu with:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
. ~/.nvm/nvm.sh
nvm install node
- install Git on Ubuntu with
sudo apt-get install
git clone
proxy repo- install dependencies with
npm install
- start server with
npm run start
- verify app up and running at url
http://[Public IPv4 DNS]:3000/rooms/:id
(for id values 0-99). NOTE: must usehttp
, nothttps
, or will return error - to stop instance, go to instance page and click Instance State > Stop Instance.