This is a project for quickly creating a basic chess player API using the cool features of Lambda & DynamoDB from AWS, all written in TypeScript. It provides the initial CRUD operations exposed over HTTP.
You can use the chess-players npm package for downloading offically published player data. Together you can currate your own santized data source, for example only store top grandmasters!
- NodeJs (v12+)
- AWS account: create here
- Serverless framework: info
Once you have created your account, proceed with the following:
npm i -g serverlessInstall dynamodb - to test your commands locally with postman or curl
sls dynamodb installTo understand more about working with DynamoDB offline see here: more info
sls offline startBefore you deploy, ensure the serverless.yml is using the correct AWS region
provider:
name: aws
runtime: nodejs12.x
region: eu-west-2 <---- change to your local regionOnce your dependencies are all installed, run:
sls deploy| Name | Method | Lambda | Description |
|---|---|---|---|
| /player | POST | createPlayer() | creates a new Player record |
| /player/{id} | GET | getPlayer() | returns a player record by id |
| /players | GET | getPlayers() | returns all players (no limit) |
| /player/{id} | PUT | updatePlayer() | updates a existing Player by id |
Note: DELETE has been left out intentionally as this is an unlikely operation
More complex queries can be added and indexes on your database table will be useful depending on how you intend to use your data.
Basic properties for a player record.
interface Player {
id: number,
name: string,
rating: number | null,
country: string,
createdAt: string,
}License: MIT
