There are two sample projects. aws-front-end and aws-back-end. aws-front-end is suppose to have internet facing VM (web server) and aws-back-end is suppose to be the app server, not accessible to the public.
Node js is the only common SDK for both the projects.
- Install node js (using nvm)
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bashsource ~/.bashrcnvm install node//This command will install latest LTS version of node and npm
- Download the source code tar.gz file from Dropbox
- Extract the source code file.
- CD into the source code folder and modify database connection parameters.
config/db-config.jsfile contains DB connection parameters.
module.exports = { database: 'edstart', username: 'postgres', password: 'postgres', host: 'edstart.cftv5465a2p0.us-east-1.rds.amazonaws.com', dialect: 'postgres'};
- Modify above parameters according to current setup.
- run
npm install - run
nohup node app.js &to start the server. - By default,
port 3333is assigned to the node process. There are two ways we can change the default port. Either we set an environment variable usingexport PORT=80or we change the default port given in theapp.jsfile. Change lineconst port = process.env.PORT || 3333;to the desired port.
- Download the source code tar.gz file fron Dropbox
- Extract the source code file.
- CD into the source code folder and modify
app server urlconfig/config.jsfile contains app server connection parameter.
module.exports = { baseUrl: 'http://172.31.23.197:3333' };
- Modify above base url. (Internal IP of the app server)
- run
npm install - run
nohup npm start &to start the server. - By default,
port 3000is assigned to the node process. Again, there are two ways to change the default port. Either we set an environment variable usingexport PORT=80or we change the default port given in thebin/wwwfile. Line no #41const port = normalizePort(process.env.PORT || '3000');
Endpoints:
Business Form: http://ec2-3-88-157-200.compute-1.amazonaws.com:3000/businesses
Businesses List: http://ec2-3-88-157-200.compute-1.amazonaws.com:3000/businesses/list