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.
Deploying the Q&A service will provision and create the following resources.
- API Gateway entitled qa-service with 10 endpoints.
- 10 * Lambda functions with associated Cloud Watch logs.
- 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
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.
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. |
Please report any feedback on the Issue Tracker.