Giter Club home page Giter Club logo

agent's Introduction

agent

fixture reservations, one HTTP call away โšฝ

architecture

architecture

local development

Prerequisites

tools remarks
Docker required
nvm for managing your Node JS environment
Redis (optional) if you prefer running a Redis instance on host machine; else see docker-compose file

Install JS depedencies

First, make sure you are using the right Node JS environment.

nvm install  # should install the version specified in .nvmrc
nvm use

Then, simply install, and grab a cup of coffee while at it โ˜•.

npm install  # including dev dependencies

Setup env vars

We provided sample env files in the names of env-*.yml.sample. You can copy these sample files, removing the .sample extension.

Please modify the environment variables accordingly.

Running Serverless Offline

Because we require AWS API Gateway and Lambda functions (with Serverless Framework), we can simply use the Serverless Offline tool to simulate a 'local' API Gateway to invoke our Lambda functions via HTTP interface.

# NOTE: local server will be listening on port 7001
sls offline --printOutput

Setup and Run dependencies

# runs both Redis container and Swagger UI for API testing;
# Else, run the services individually if preferred
docker-compose up

Testing API endpoints locally

# using o'fashioned curl to create a fixture request
curl -H 'Authorization: Basic [username:password encoded in base64]'\
 -H 'Content-Type: application/json'\
  -X POST\
 -d '{"court": "outdoor", "date": "2020-12-31", "time": "1700-1900"}'\
 http://localhost:7001/bonfim\
  | jq ".id"
 # (optional) you can also pipe the response to jq and get the id

If a graphical UI is preferred instead, check out how to test using Swagger UI

Lint

We use Eslint for linting, and follow the now-classic Airbnb Eslint config.

npm run lint

Unit Tests

npm test

Open API spec

Please see here for the API document (following OpenAPI 3.0).

For a more interactive experience with Swagger UI, you may like to:

docker-compose up openapi

and point to http://localhost:7777

agent's People

Contributors

dependabot[bot] avatar kelvintaywl avatar

Watchers

 avatar

agent's Issues

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.