This is the Disc Rescue Network API. Click here to view the API spec.
Install with yarn
Run with yarn start
Run docker build -t drn-api .
For deploying to ECR view push commands in the AWS console, then use ECS to deploy the drn-api
ECS task.
This app will throw an error and notify you of missing environment variables. The current required are:
APP_PORT
= API port to serve onAPP_CORS
= This API CORS, can be a comma separated listDB_HOST
= Database host to connect toDB_USER
= Database user to useDB_PASSWORD
= Database user passwordDB_NAME
= The database name to query onAUTH_ISSUER
= issuer of auth bearer tokensAUTH_AUDIENCE
= AUD for auth bearer token validationTWILIO_SID
= Twilio SID from account details in loginTWILIO_AUTH_TOKEN
= Twilio Auth Token from account details in loginTWILIO_SEND_FROM
= the Twilio number to send messages fromTWILIO_WEBHOOK_URL
= the Twilio webhook url where new messages get POSTed to on this APITWILIO_VCF_URL
= where the VCard is served fromTWILIO_MESSAGING_SID
= MGXXXXXXXXXX
app.ts
is the main entry point for starting the app routing where middleware and endpoints are established.
middleware.ts
has additional custom middleware functions, i.e. validating org_code in auth bearer token.
api.json
is the OpenAPI spec that enforces requests and responses, returning a specific error message on what is wrong with the request to the requesting client, or the server depending on which violates the response format.
Services is where the app routes requests to be handled. Within services is subdirectores for domains, and each domain can have subdomains.
This includes:
-
Found disc inventory
-
Opt in/out and twilio messaging functions
-
Disc golf disc mold types
-
Disc golf disc brands
-
Disc golf courses related to inventory in the system
-
Google Vision for text detection with confidence scores
note: this relies on a google credentials.json being in the
/vision
subdirectory
This is the database directory where all database operations live. Uses a MySQL query generation library zzzql.