Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content
This repository has been archived by the owner on Jul 10, 2022. It is now read-only.
/ agent Public archive

fixture reservations, one HTTP call away ⚽

Notifications You must be signed in to change notification settings

futsaltokyo/agent

Repository files navigation

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

Releases

No releases published

Packages

No packages published