Giter Club home page Giter Club logo

cc-test's Introduction

cc-test

A simple REST API built with AWS SAM, consisting of a single AWS Lambda behind an API Gateway which stores the records in DynamoDB table. New changes are deployed automatically to the dev env on push to the main branch, via a simple GitHub workflow.

Architecture diagram:

architecture diagram

Capabilities

  • Simple CRUD REST API
  • A deployment pipeline
  • IAM roles used
  • Lambda have a minimum required set of permissions (I've used a single lambda, a split could help here)
  • Visual diagram created
  • Resource names defined in env variables (example: USERS_TABLE_NAME)
  • Input validation (using yup)
  • Typescript used

Extras:

  • Unit test coverage

API doc (examples)

The API exposes 4 simple endpoints:

/users [GET, POST]
/users/{id} [DELETE, PATCH]

TODO: Create a swagger documentation.

Examples

Replace {url} with an API endpoint, and {id} with UUID of a given user.

Create a new user:

curl -X POST -H "Content-Type: application/json" -d "{\"name\":\"BradyMoss\",\"email\":\"[email protected]\"}" {url}/users

Get a list of users:

curl -X GET {url}/users

Edit a given user:

curl -X PATCH -H "Content-Type: application/json" -d "{\"name\":\"BradyMossEdited\",\"email\":\"[email protected]\"}" {url}/users/{id}

Delete a given user:

curl -X DELETE {url}/users/{id}

Example commands

Installing dependencies locally: cd users && npm install

Running unit tests: cd users && npm run test

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.