├── .gitignore ├── .prettierrc ├── index.js ├── package.json ├── .vscode └── settings.json └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "bracketSpacing": true, 3 | "printWidth": 80, 4 | "singleQuote": true, 5 | "tabWidth": 2, 6 | "trailingComma": "all", 7 | "useTabs": false 8 | } 9 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | var http = require('http'); 2 | 3 | //create a server object: 4 | http.createServer(function (req, res) { 5 | res.write('A Monk in Cloud'); //write a response to the client 6 | res.end(); //end the response 7 | }).listen(80); //the server object listens on port 80 8 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "node-hello", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "start": "node index.js" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "git+https://github.com/johnpapa/node-hello.git" 12 | }, 13 | "keywords": [], 14 | "author": "", 15 | "license": "ISC", 16 | "bugs": { 17 | "url": "https://github.com/johnpapa/node-hello/issues" 18 | }, 19 | "homepage": "https://github.com/johnpapa/node-hello#readme" 20 | } 21 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "workbench.colorCustomizations": { 3 | "activityBar.activeBackground": "#dd894d", 4 | "activityBar.activeBorder": "#aff0ca", 5 | "activityBar.background": "#dd894d", 6 | "activityBar.foreground": "#15202b", 7 | "activityBar.inactiveForeground": "#15202b99", 8 | "activityBarBadge.background": "#aff0ca", 9 | "activityBarBadge.foreground": "#15202b", 10 | "editorGroup.border": "#dd894d", 11 | "panel.border": "#dd894d", 12 | "sideBar.border": "#dd894d", 13 | "statusBar.background": "#cf6d28", 14 | "statusBar.border": "#cf6d28", 15 | "statusBar.foreground": "#15202b", 16 | "statusBarItem.hoverBackground": "#a45620", 17 | "titleBar.activeBackground": "#cf6d28", 18 | "titleBar.activeForeground": "#15202b", 19 | "titleBar.border": "#cf6d28", 20 | "titleBar.inactiveBackground": "#cf6d2899", 21 | "titleBar.inactiveForeground": "#15202b99" 22 | }, 23 | "peacock.color": "#cf6d28" 24 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Node Hello World 2 | 3 | Simple node.js app that servers "A Monk in Cloud" 4 | 5 | Great for testing simple deployments on Cloud 6 | 7 | ## Step 1: Install NodeJS and NPM using nvm 8 | Install node version manager (nvm) by typing the following at the command line. 9 | 10 | ```bash 11 | sudo su - 12 | curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash 13 | ``` 14 | Activate nvm by typing the following at the command line. 15 | 16 | ```bash 17 | . ~/.nvm/nvm.sh 18 | ``` 19 | 20 | Use nvm to install the latest version of Node.js by typing the following at the command line. 21 | 22 | ```bash 23 | nvm install node 24 | ``` 25 | 26 | Test that node and npm are installed and running correctly by typing the following at the terminal: 27 | 28 | ```bash 29 | node -v 30 | npm -v 31 | ``` 32 | 33 | ## Step 2: Install Git and clone repository from GitHub 34 | To install git, run below commands in the terminal window: 35 | 36 | ```bash 37 | sudo apt-get update -y 38 | sudo apt-get install git -y 39 | ``` 40 | 41 | Just to verify if system has git installed or not, please run below command in terminal: 42 | ```bash 43 | git — version 44 | ``` 45 | 46 | This command will print the git version in the terminal. 47 | 48 | Run below command to clone the code repository from Github: 49 | 50 | ```bash 51 | git clone https://github.com/yeshwanthlm/nodejs-on-ec2.git 52 | ``` 53 | 54 | Get inside the directory and Install Packages 55 | 56 | ```bash 57 | cd nodejs-on-ec2 58 | npm install 59 | ``` 60 | 61 | Start the application 62 | To start the application, run the below command in the terminal: 63 | 64 | ```bash 65 | npm start 66 | ``` 67 | 68 | --------------------------------------------------------------------------------