Skip to content

fquevedo/fzsportsApi

Repository files navigation

FzSports Test

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Deploy Infrastructure
  5. License
  6. Contact

About The Project

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.

(back to top)

Built With

This section list frameworks/libraries used in the project.

(back to top)

Getting Started

To get a local copy up and running follow these steps.

Prerequisites

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

Installation

For continue, make sure GIT and NPM are installed already.

  1. Clone the repository
    git clone https://github.com/fquevedo/fzsportsApi.git
  2. Install NPM packages
    npm install
  3. Create .env file in root folder project with the following variables
     DB_URI=mongodb://localhost:27017
     DB_NAME=fzsports
  4. Use this command for ingest database
    npm run build
  5. 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.

(back to top)

Usage

  1. Start service
    npm start

Use the following links for test the endpoints

  1. Get all teams /api/team
  2. Get players who play in :teamId /api/teams/:teamId/players
  3. Get players who play as :position /api/teams/players/delantero

(back to top)

Deploy Infrastructure

Ensure that AWS CLI is installed, and properly configured with an AWS IAM profile.

  1. Locate in terraform-aws folder
    cd IaaS/terraform-aws
  2. Initialize backend
    terraform init
  3. Deploy the infrastructure
    terraform apply --auto-approve

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Contact

Project Link: https://github.com/fquevedo/fzsportsApi

(back to top)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published