• Stars
    star
    240
  • Rank 168,229 (Top 4 %)
  • Language
    JavaScript
  • Created over 7 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

位 serverless backend implementation for RealWorld using AWS DynamoDB + Lambda

RealWorld Example App

RealWorld Backend Build Status Coverage Status Greenkeeper badge Known Vulnerabilities Gitter

AWS DynamoDB + Lambda codebase containing real world examples (CRUD, auth, advanced patterns, etc) that adheres to the RealWorld spec and API.

Demo

This codebase was created to demonstrate a fully fledged fullstack application built with AWS DynamoDB + Lambda including CRUD operations, authentication, routing, pagination, and more.

We've gone to great lengths to adhere to the AWS DynamoDB + Lambda community styleguides & best practices.

For more information on how to this works with other frontends/backends, head over to the RealWorld repo.

Getting started

Requires Node 8 or higher

Clone this repo, and cd into it:

git clone https://github.com/anishkny/realworld-dynamodb-lambda
cd realworld-dynamodb-lambda

Starting the local server

npm install
npm run start

This should start local DynamoDB emulator and Serverless offline. You can now make API calls against http://localhost:3000/api like this:

curl http://localhost:3000/api/articles

Serverless: GET /api/articles (位: listArticles)
Serverless: The first request might take a few extra seconds
Serverless: [200] {"statusCode":200,"headers":{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Credentials":true},"body":"{\"articles\":[]}"}

Running tests locally

npm test

See sample test run log and network traffic.

How it works

Overview

This repo uses Serverless Framework to describe, test and deploy the RealWorld REST API to AWS Lambda. AWS Lambda provides "serverless" cloud functions as a service. AWS API Gateway is used to expose the deployed Lambda functions as a HTTP REST API.

Architecture Diagram

API

The API is described in the serverless.yml file. For example the following snippet instructs AWS Lambda to execute the create method in src/User.js whenever a POST method is called on /api/users:

functions:

  ## Users API
  createUser:
    handler: src/User.create
    events:
      - http:
          method: POST
          path: /api/users
          cors: true

  ...

Storage

For storage, AWS DynamoDB a managed serverless NoSQL database is used. Tables are created to store users, articles and comments also described in serverless.yml file. For example:

resources:
  Resources:

    UsersDynamoDBTable:
      Type: 'AWS::DynamoDB::Table'
      DeletionPolicy: Retain
      Properties:
        AttributeDefinitions:
        ...

Deployment

To deploy the code to AWS, simply execute:

npm run deploy

This will use serverless to deploy the API as described in serverless.yml.

Once deployed, you can test the deployed API by executing:

npm run test:deployed

More Repositories

1

integrify

馃 Enforce referential and data integrity in Cloud Firestore using triggers
TypeScript
109
star
2

webgif

Easily generate animated GIFs from websites
JavaScript
105
star
3

playwright-test-coverage

Extends Playwright test to measure code coverage
JavaScript
79
star
4

realworld-e2e-test

End-to-end testing for a RealWorld React/NodeJS stack using Mocha and Chrome Puppeteer
JavaScript
70
star
5

realworld-nuxt

Nuxt.js implementation of RealWorld Frontend
Vue
46
star
6

playwright-test-coverage-demo

Demonstrates usage of playwright-test-coverage - a Playwright extension that collects code coverage from running end-to-end tests
JavaScript
18
star
7

realworld-firebase-gcp-cloud-functions

A Firebase + GCP Cloud Functions backend implementation for RealWorld
JavaScript
7
star
8

puppeteer-on-cloud-functions

Run Chrome Puppeteer on Google Cloud Functions
JavaScript
6
star
9

docusaurus-base

Netlify template for Docusaurus
JavaScript
4
star
10

nodejs-in-matlab

Call Node.js from within MATLAB
MATLAB
4
star
11

realworld-gcp-datastore-cloud-functions

Serverless GCP Cloud Functions + Datastore implementation of RealWorld Backend
JavaScript
3
star
12

vuepress-base

Starter template for VuePress
3
star
13

dotnet-minimal-api-example

ASP.NET Minimal API Tutorial with Postman tests and code coverage
C#
3
star
14

circleci-test-drive

2
star
15

travis-build-history

JavaScript
2
star
16

deno-api-tests-coverage

Measure code coverage of a Deno server when running Postman (newman) API tests
TypeScript
1
star
17

netlify-edge-functions-test

TypeScript
1
star
18

realworld-jasonette

A Jasonette (Android/iOS) implementation of the RealWorld frontend
1
star
19

deno-test

JavaScript
1
star
20

vuepress-test

1
star
21

vercel-test

JavaScript
1
star
22

travis-ci-test-drive

JavaScript
1
star
23

vitepress-starter

Starter repo for VueJS Vitepress documentation generator
1
star
24

firestore-timestamps

JavaScript
1
star
25

udd-action-test

1
star
26

deno-hello

The simplest possible Deno module
Dockerfile
1
star
27

meticulous-test

TypeScript
1
star