/aws-workshop

Workshop based on https://gum.co/aws-good-parts :rocket:

Primary LanguageJavaScriptMIT LicenseMIT

aws-workshop

This workshop is based on The Good Parts of AWS.

Installation

Install git and npm.

Getting Started

Create a new directory, initialize git and npm.

$ mkdir aws-workshop && cd aws-workshop
$ git init
$ npm init -y

Create a simple server.js:

const {hostname} = require('os');
const http = require('http');
const message = 'Hello World\n';
const port = 8080;

const server = http.createServer((req, res) => {
    res.statusCode = 200;
    res.setHeader('Content-Type', 'text/plain');
    res.end(message);
});

server.listen(port, hostname, () => {
    console.log(`Server running at http://${hostname()}:${port}/`);
});

Use node to execute server.js.

$ node server.js

Open a new terminal and test:

$ curl localhost:8080

Update package.json with pm2 dependency.


{
  "name": "aws-workshop",
  "version": "1.0.0",
  "description": "Foobar is a Python library for dealing with word pluralization.",
  "main": "server.js",
  "scripts": {
    "start": "node ./node_modules/pm2/bin/pm2 start ./server.js --name hello_aws --log ../logs/app.log ",
    "stop": "node ./node_modules/pm2/bin/pm2 stop hello_aws"
  },
  "dependencies": {
    "pm2": "^4.2.0"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/russomi-labs/aws-workshop.git"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "bugs": {
    "url": "https://github.com/russomi-labs/aws-workshop/issues"
  },
  "homepage": "https://github.com/russomi-labs/aws-workshop#readme"
}


Run npm install to install the dependency.

$ npm install

Create the logs directory:

$ mkdir ../logs

Issue npm start and test.

$ npm start
$ curl localhost:8080

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT