jacksoncharles / serverless-qa-template-api

Serverless Q&A template API. Written in NodeJS and deployed to AWS. Designed to be implemented as part of a distributed service. Exploits Lambda, API Gateway, Cloudwatch & Dynamodb.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Serverless Q&A Template API

A big data, serverless Q&A template API with robust CRUD functionality that can be easily built upon and used for everyday services such as discussion forums, comments and surveys. Deployed to AWS using the Serverless Framework.

Includes pagination and global secondary indexes for retrieiving by user, thread or unique key and is multi-tenancy ready. Loosely inspired and modeled upon the AWS Example Forum and designed to be implemented as part of a distributed system.

Technology Stack

  1. AWS Lambda
  2. AWS DynamoDB
  3. AWS API Gateway
  4. AWS Cloudwatch
  5. Serverless Framework
  6. NodeJs

Installation & Deployment

Deploying the Q&A service will provision and create the following resources.

  1. API Gateway entitled qa-service with 10 endpoints.
  2. 10 * Lambda functions with associated Cloud Watch logs.
  3. 2 * DynamoDB tables called Thread and Reply.

To deploy from your desktop you must have an existing AWS account with command line access.

Firstly, install the Serverless Framework.

    npm install serverless -g

Secondly, install the Serverless Framework dependencies.

    npm install

Next, install your Q&A service dependencies.

    npm run-script buildapi

Lasty, deploy your Q&A service.

    sls deploy

If you wish to load test data into your application you can run the loadData script.

	./loadData.sh

Removal

To remove the solution from AWS at the command line

	sls remove

NOTE: Will automatically remove any Lambda functions, Cloud Watch logs and API Gateway configurations. It will not remove DynamoDb tables; They must be deleted manually.

Lambda Functions and EndPoints

Will create 10 Lambda functions accessible via API Gateway configured endpoints.

NAME LAMBDA GATEWAY URL VERB DESCRIPTION
CREATE threadCreate /threads POST Create a new item in permanent storage.
LIST threadList /threads GET Retrieve a paginated listing from permanent storage.
GET threadGet /threads/:id GET Retrieve a individual item using the threadid or userid passed in the query string.
UPDATE threadUpdate /threads/:id PUT Update details of a post by providing a full array of model data.
DELETE threadDelete /threads/:id DELETE Remove an item from permanent storage.
CREATE replyCreate /replies POST Create a new item in permanent storage.
LIST replyList /replies GET Retrieve a paginated listing from permanent storage.
GET replyGet /replies/:id GET Retrieve a individual item using the threadid or userid passed in the query string.
UPDATE replyUpdate /replies/:id PUT Update details of a post by providing a full array of model data.
DELETE replyDelete /replies/:id DELETE Remove an item from permanent storage.

Issues

Please report any feedback on the Issue Tracker.

About

Serverless Q&A template API. Written in NodeJS and deployed to AWS. Designed to be implemented as part of a distributed service. Exploits Lambda, API Gateway, Cloudwatch & Dynamodb.


Languages

Language:JavaScript 99.5%Language:Shell 0.5%