API powered by Serverless, TypeScript, Webpack, Node.js and DynamoDB, intended as a starting point for Serverless APIs. I've also created a React/Redux-powered UI to front this API. Auth0 handles authentication. You must signup/login to generate an auth token and gain access to the secured area. All endpoints in the API check validity of the auth token and return unauthorised if invalid, the UI then prompts you to log in again. The API also determines the identity of the user via the auth token.
See Apiary for API structure - defined in apiary.apib.
- Serverless
- TypeScript
- Node.js
- Webpack
- DynamoDB
- Serverless-offline
- Serverless-webpack
- Serverless-dynamodb
- Serverless-domain-manager
- Jsonwebtoken
- Docker
To run locally you must run two servers - DB and API.
Serverless-webpack, serverless-dynamodb-local and serverless-offline offer great tooling for local Serverless development. To start local servers that mimic AWS API Gateway and DyanamoDB, run the commands below. Both servers will fire up and code will be reloaded upon change so that every request to your API will serve the latest code.
Serverless-dynamodb-local requires Java Runtime Engine (JRE) version 6.x or newer.
AUTH0_CLIENT_SECRET environment variable must be set before yarn run dev
command below. Optional DYNAMODB_PORT and DYNAMODB_HOST environment variables may be set to override the defaults (localhost:8000).
E.g. AUTH0_CLIENT_SECRET=YOUR_SECRET yarn run dev
yarn install (serverless dynamodb install included as postinstall script)
yarn run dev
Submit requests to http://localhost:3000. The DynamoDB shell console is available at http://localhost:8000/shell.
Maintaining a Java installation for the sake of running DynamoDB locally is a pain, running in a Docker container is far easier. As above, to run locally you must run two servers - DB and API.
To start the local servers that mimic AWS API Gateway and DyanamoDB using docker, run the commands below.
AUTH0_CLIENT_SECRET environment variable must be set before docker-compose up --build
command below.
E.g. AUTH0_CLIENT_SECRET=YOUR_SECRET docker-compose up --build
docker-compose up --build
Submit requests to http://localhost:3000. The DynamoDB shell console is available at http://localhost:8000/shell.
TBC
Refer to the /infrastructure directory.