Player API allows to perform some actions such as :
- Sorted list of all players by rank ASC (from first to last): Demo 👉 here
- Get a player with a given
Id
: Demo 👉 here - Get some players stats : Demo 👉 here
- Basic documentation 👉 here
This API is a simple REST API wrapped as a Lambda function, deployed on AWS using Serverless framework and Github Actions pipeline. The following components are used:
- AWS Lambda to wrap the REST API,
- Amazon S3 to store the list of players in a JSON file inside a Bucket,
- Amazon API Gateway which provide tools to route HTTP requests to the lambda functions for our needs.
- NestJS a NodeJS framework
- Serverless framework
# install node dependencies
$ yarn install
To make the API work locally, you must have an AWS account and configure a an AWS profile on your local machine ( in .aws/credentials file
) to be able to access AWS ressources. Once this done, you need to install :
- serverless framework (
npm install -g serverless
) - AWS CLI : to interact with the AWS cli. See 👉 here
Now connect to AWS console and do the following actions
- Create a s3 Bucket and place a JSON file containing all the players. In my case, the
S3_BUCKET_NAME
is equal toapi-players
and theS3_BUCKET_FILE_NAME
is equal toplayer.json
Once this done, you need to create a .env at the root directory with the following Variables
AWS_PROFILE
= Your AWS ProfileS3_BUCKET_NAME
= api-playersS3_BUCKET_FILE_NAME
=players.json
(Or another name.json
)AWS_SETTING_REGION
= Your AWS Region
# development
$ yarn run start
# watch mode
$ yarn run start:dev
# production mode
$ yarn run start:prod
# deploy for dev stage
$ serverless deploy
# deploy for prod stage
$ serverless deploy --stage prod
# unit tests
$ yarn run test
# e2e tests
$ yarn run test:e2e
# test coverage
$ yarn run test:cov
- Add more tests cases
- improve the documentation and the Readme
- Author - Foujeu Pavel
Nest is MIT licensed.