Giter VIP home page Giter VIP logo

prsls's Introduction

Production-Ready Serverless

Place orders and accept/reject them done with Serverless Framework using AWS Lambda, API Gateway, DynamoDB, EventBridge, SNS, Cognito, SSM & SQS

▶️ Demo site

  1. Register

  2. Place orders clicking in restaurants

  3. Simulate restaurant response accepting or rejecting them curling like this:

    API=https://lrmnkd5aj8.execute-api.us-east-1.amazonaws.com/prod/order
    ACCEPTANCE_URL=${API}/acceptance
    ORDER=<your order>
    ACCEPTANCE=order_accepted
    # or
    ACCEPTANCE=order_rejected 
    curl -d '{"orderId":"'"${ORDER}"'", "acceptance":"'"${ACCEPTANCE}"'"}' -H "Content-Type: application/json" -X POST $ACCEPTANCE_URL
  4. In the case you accepted the order you can complete it

  5. Once you complete or reject the order you can delete it curling like this:

    DELETE_URL=${API}/delete
    ORDER=<your order>
    curl --request GET \
      --url $DELETE_URL/$ORDER

Deployment instructions

  1. Use Node 20 version, using nvm you can:

    # set Node 20 in current terminal
    nvm use 20
    # set Node 20 as default (new terminals will use 20)
    nvm alias default 20
    
  2. Install dependencies and deploy on your stage (provided you configured your AWS credentials)

    npm i
    # deploy on dev stage
    npm run sls -- deploy
    # ...to deploy on prod stage
    npm run sls -- deploy -s prod
  3. Configure these parameters in AWS Systems Manager > Parameter Store:

    /prsls/${stage}/get-restaurants/config:

    {
       "defaultResults": 8
    }

    /prsls/${stage}/search-restaurants/config:

    {
       "defaultResults": 8
    }
  4. Populate the database with restaurants:

    export restaurants_table=<DynamoDB table for the stage>
    node -e 'require("./tests/steps/given.js").eight_initial_restaurants()'

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.