Coder Social home page Coder Social logo

netto-jm / back-end-soccer-management-app Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 668 KB

A dockerized backend that provides functionality to manage soccer matches and is intended to be consumed by an already available frontend.

Dockerfile 0.95% JavaScript 26.25% TypeScript 61.17% HTML 1.14% CSS 9.73% Shell 0.77%
mocha-chai nodejs sequelize soccer-matches typescript

back-end-soccer-management-app's Introduction

Back-End Soccer Management App

soccer

This is the README for the "Back-End Soccer Management App" project. This is a dockerized backend that provides functionality to manage soccer matches and is intended to be consumed by an already available frontend.

Table of Contents

  1. Technologies Used
  2. Installation Requirements
  3. How to Use
  4. Project Structure
  5. Endpoints
  6. Configuration
  7. Author
  8. Contact

Technologies Used

Dependencies:

  • bcryptjs: Library for password encryption.
  • cors: Middleware to enable cross-origin resource sharing (CORS) for the API.
  • express: Framework for building RESTful APIs in Node.js.
  • express-async-errors: Middleware to simplify handling of asynchronous errors.
  • joi: Library for data validation and schema definition.
  • jsonwebtoken: Implementation of JSON Web Tokens for authentication.
  • mysql2: Package for interacting with MySQL databases.
  • sequelize: Object-Relational Mapping (ORM) for database operations.

DevDependencies:

  • chai: Assertion framework used with Mocha for testing.

  • chai-as-promised: Extension for working with promises in Chai tests.

  • chai-http: Extension for making HTTP requests in Chai tests.

  • eslint: Tool for linting and code correction in JavaScript/TypeScript.

  • mocha: Testing framework.

  • nodemon: Utility that monitors file changes and automatically restarts the server.

  • nyc: Code coverage tool for testing.

  • sequelize-cli: Command Line Interface (CLI) for Sequelize, used for running database-related tasks.

  • sinon: Library for creating spies and stubs in tests.

  • ts-node: TypeScript executor for Node.js.

  • ts-node-dev: Tool for automatically restarting the Node server when TypeScript files change.

  • typescript: Programming language for Node.js.

  • TypeScript type definition packages (e.g., @types/bcryptjs, @types/chai, etc.) for improved type support in TypeScript projects.

Installation Requirements

To run this project, you need to have Docker installed on your system. Follow the steps below:

  1. Clone this repository to your local environment.

  2. Navigate to the project's root directory.

  3. Execute the following command to start the Docker containers:

    npm run compose:up

This command will start the containerized services, including the backend, frontend, and MySQL database.

How to Use

Make sure the Docker containers are running. The backend should be listening on port 3001. The frontend will communicate with the backend service at http://localhost:3001 through the endpoints defined in the backend.

Authentication is required to add a match. Users must be logged in to make changes.

Project Structure

The project structure consists of three main parts: the database, the backend, and the frontend. Here is an overview of the structure:

  • db: Contains database configuration and runs in a Docker MySQL container.
  • app/backend: The source code of the backend, including routes and controllers. It runs on port 3001.
  • app/frontend: The frontend that communicates with the backend through the defined endpoints.

Endpoints

The "Back-End Soccer Management App" API offers the following endpoints for performing operations related to teams, matches, authentication, and leaderboard:

Teams

  • List All Teams

    • Method: GET
    • Route: /teams/
    • Description: Returns a list of all teams.
    • Authentication: No authentication required.
  • Get Team by ID

    • Method: GET
    • Route: /teams/:id
    • Description: Returns information about a team based on the provided ID.
    • Authentication: No authentication required.

Authentication

  • Get Role of Logged-In User

    • Method: GET
    • Route: /login/role
    • Description: Returns the role of the authenticated user.
    • Authentication: Requires user authentication.
  • User Login

    • Method: POST
    • Route: /login/
    • Description: Allows a user to log in to the system.
    • Authentication: No authentication required.

Matches

  • List All Matches

    • Method: GET
    • Route: /matches/
    • Description: Returns a list of all matches.
    • Authentication: No authentication required.
  • Create Match

    • Method: POST
    • Route: /matches/
    • Description: Creates a new match.
    • Authentication: Requires user authentication.
  • Update Match by ID

    • Method: PATCH
    • Route: /matches/:id/
    • Description: Updates an existing match based on the provided ID.
    • Authentication: Requires user authentication.
  • Finish Match by ID

    • Method: PATCH
    • Route: /matches/:id/finish
    • Description: Marks a match as finished based on the provided ID.
    • Authentication: Requires user authentication.

Leaderboard

  • List Overall Leaderboard

    • Method: GET
    • Route: /leaderboard/
    • Description: Returns the overall leaderboard for all teams.
    • Authentication: No authentication required.
  • List Home Teams Leaderboard

    • Method: GET
    • Route: /leaderboard/home
    • Description: Returns the leaderboard for home teams.
    • Authentication: No authentication required.
  • List Away Teams Leaderboard

    • Method: GET
    • Route: /leaderboard/away
    • Description: Returns the leaderboard for away teams.
    • Authentication: No authentication required.

Configuration

Ensure that the endpoints are correctly configured in your application and are accessible through the routes defined in your route files.

For specific details on the functionalities of each endpoint, refer to the source code in the app/routes directory.

Author

  • Juvenal Martins dos Santos Netto

Contact

If you have any questions or need assistance, please contact me via email: [email protected].

back-end-soccer-management-app's People

Contributors

netto-jm avatar trybe-tech-ops avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.