Skip to content

ravishan16/ExpressApi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ExpressApi

This project is a Boilerplate for building RESTful API with Node.js, Express and DynamoDB. Deployed in a server-less way to AWS Lambda and AWS API Gateway using Claudia.js and dev local using gulp

Architecture

Simple REST API deplyed in AWS Lambda persisting data into DynamoDB and retrieving data back.

Express is a minimal and flexible Node.js micro web application framework. Express provides HTTP utility methods and middleware to create quick API.

API Gateway and Lambda together provides a secure, easy and elegant way to create and deploy serverless Web applications without the overhead of managing servers.

Amazon DynamoDB is a fully managed and hosted AWS NoSQL database service.

Claudia.js is an open source Node.js deployment tool that helps automated deployment of Node.js app in a server-less way to AWS Lambda and AWS API Gateway.

Architecture - Ravishankar Sivasubramaniam

Getting Started

The easiest way to get started is to clone the repository:

Get the latest snapshot

git clone --depth=1 [email protected]:ravishan16/ExpressApi.git myproject
cd myproject

Install NPM dependencies

npm install

To Install Gulp commandline run

sudo npm install -g gulp

Start App Local

Execute gulp. This invokes app.local.js under scripts. gulp-nodemon Automatically restart Node.js server on code changes.

gulp

Express App deployment in AWS

Deploying a NodeJS app to AWS can be done is so many different ways. One of the easiest way is to use ClaudiaJS and deploy the app in a server-less way to AWS Lambda and AWS API Gateway.

  1. Configure awscli
  2. Create table in DynamoDB
  3. Deploy App to AWS
  4. Push changes to AWS

Configure awscli

pip install awscli
aws configure
AWS Access Key ID [None]: XXXX
AWS Secret Access Key [None]: XXXX
Default region name [None]: us-east-1
Default output format [None]: json

Create Tables in DynamoDB

create-db is defined as task in package.json script. This executes scripts/createDB.js

npm run create-db

Deploy App to AWS

Use deploy for first time deployment. deploy is defined as npm run task in package.json script

claudia create --policies policies --handler lambda.handler --deploy-proxy-api --region us-east-1

npm run deploy

Push changes to AWS

Use update for update to initial deployment. update is defined as npm run task in package.json script

claudia update

npm run update

-- Ravishankar Sivsasubramaniam