Table of Contents
This project is a simple API Server that allows to request Team and Players information obtained from a no relational database, imported from a xml source gived by FzSports. Also, contains the services (IaaS Folder) to deploy a VPC infrastructure with 4 subnets (2 public and 2 private), a Security Group and an ALB Listener Frontend using Terraform with AWS as provider. Docker and Jenkins files are implemented in IaaS Folder.
This section list frameworks/libraries used in the project.
To get a local copy up and running follow these steps.
In order to install the project, make sure Docker is installed. Let's pull a MongoDB image and run it locally using Docker.
- MongoDB
docker pull mongodb
docker run --name local_mongo -p 27017:27017 -d mongo
Aditionally, pull and run jenkins locally
- Jenkins
docker pull jenkins
docker run -p 8080:8080 -p 50000:50000 jenkins
For continue, make sure GIT and NPM are installed already.
- Clone the repository
git clone https://github.com/fquevedo/fzsportsApi.git
- Install NPM packages
npm install
- Create .env file in root folder project with the following variables
DB_URI=mongodb://localhost:27017 DB_NAME=fzsports
- Use this command for ingest database
npm run build
- In order to use Jenkins for docker auto image creation, ensure docker is login locally. Then, create a pipeline and setup using this repository. That allows Jenkins automatically create an image and upload it to dockerhub if all unit test are passed.
- Start service
npm start
Use the following links for test the endpoints
- Get all teams /api/team
- Get players who play in :teamId /api/teams/:teamId/players
- Get players who play as :position /api/teams/players/delantero
Ensure that AWS CLI is installed, and properly configured with an AWS IAM profile.
- Locate in terraform-aws folder
cd IaaS/terraform-aws
- Initialize backend
terraform init
- Deploy the infrastructure
terraform apply --auto-approve
Distributed under the MIT License. See LICENSE.txt
for more information.
Project Link: https://github.com/fquevedo/fzsportsApi