Awesome Open Source
Awesome Open Source

Serverless Stack Demo API

The Serverless Stack Guide is a free comprehensive resource to creating full-stack serverless applications. We create a note taking app from scratch.

This repo is for the serverless backend API that we build over the course of the tutorial. You can find the repo for the frontend React app here. And the repo for the tutorial here.

This repo is split into:

Steps

To support the different chapters and steps of the tutorial; we use branches to represent the project codebase at the various points. Here is an index of the various chapters and branches in order.

Usage

To use this repo locally you need to have the Serverless framework installed.

$ npm install serverless -g

Clone this repo.

$ git clone https://github.com/AnomalyInnovations/serverless-stack-demo-api

Head over to the infrastructure/ directory and install the npm packages.

$ npm install

And build the SST app.

$ npx sst build

Then deploy it to your AWS account

$ npx sst deploy

Then head over to services/notes/. And run a single API endpoint locally.

$ serverless invoke local --function list --path event.json

Where, event.json contains the request event info and looks something like this.

{
  "requestContext": {
    "authorizer": {
      "claims": {
        "sub": "USER-SUB-1234"
      }
    }
  }
}

Finally, run this to deploy to the API to your AWS account.

$ serverless deploy

The API service refers to an .env file for secret environment variables that are not checking in to the repo. Make sure to create one before deploying - https://serverless-stack.com/chapters/load-secrets-from-env.html.


This repo is maintained by Serverless Stack.


Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
javascript (70,403
demo (503
api-gateway (126
dynamodb (105
serverless-framework (101
aws-sdk (44