Golang api for a league of legends teamfinder project

League teamfinder API

Your project's logo

shields.io badge

Golang api for a league of legends teamfinder project

Table of Contents

Introduction

The following documentation assumes previous knowledge of:

  • Docker containers
  • General API usage (call a route, differences between get, post, patch operations, send a request with body or with data on headers, process a response...)
  • Understanding of the purpose of the API; being able to answer the questions:
    • What the API has ben built for?
    • What resources are managed by it

Getting Started

Prerequisites

  • Install golang from the reference guide
  • Install docker from the official site
  • Optional: vscode addons for golang

Installation

  • Open a terminal and navigate to your golang working directory

    cd PATH/TO/YOUR/GOLANG/WORK/DIRECTORY
  • Run the command on the terminal to clone the project from the gitlab repository

     git clone https://gitlab.com/lol_fashion/lol-api.git

Run locally

  1. You will find a folder named lol-api, navigate inside the folder with the command

    cd ./lol-api`
  2. Run this command to install all the necessary golang packages

    go get -v ./...
  3. Paste the following data into the .env file inside the folder and update the variables

    version: "3.7"
    services:
    
    lol-api:
        build: ./lol-api
        image: lol-api:latest
        restart: always
        container_name: lol-api
        depends_on:
        environment:
            PORT: your_db_port
            GO_ENV: development
            SERVER_LOGS_PATH: logs/server_info.log
            FRONT_LOGS_PATH: logs/front_info.log
            CORS_ALLOWED_ORIGINS: your_allowed_url_1, your_allowed_url_2
            ACCESS_CONTROL_ALLOW_CREDENTIALS: your_allowed_url_1, your_allowed_url_2
            CORS_ADMIN_ORIGINS: your_allowed_url_1, your_allowed_url_2
            DB_ENV: dev
            DB_PORT: your_rethinkdb_port
            DB_HOST: your_rethinkdb_host
            MAIL_SEND_TO: your_email
            MAIL_USER: your_email_user
            MAIL_PASS: your_email_pass
        volumes:
        - ./mounted/logs:/go/src/lol-api/logs
        ports:
        - "8082:81"
  4. After completing the 3 previous steps, the project should be configured and ready to run, in order to launch it execute the following command, which will start the server and will show the logs on the terminal

    go run app.go

Run with docker

  1. Create a file called docker-compose.yml in the same directory of the lol-api folder

  2. Paste the following content into the docker-compose.yml file:

    version: "3.7"
    services:
    
    lol-api:
        build: ./lol-api
        image: lol-api:latest
        restart: always
        container_name: lol-api
        depends_on:
        environment:
            PORT: your_db_port
            GO_ENV: development
            SERVER_LOGS_PATH: logs/server_info.log
            FRONT_LOGS_PATH: logs/front_info.log
            CORS_ALLOWED_ORIGINS: your_allowed_url_1, your_allowed_url_2
            ACCESS_CONTROL_ALLOW_CREDENTIALS: your_allowed_url_1, your_allowed_url_2
            CORS_ADMIN_ORIGINS: your_allowed_url_1, your_allowed_url_2
            DB_ENV: dev
            DB_PORT: your_rethinkdb_port
            DB_HOST: your_rethinkdb_host
            MAIL_SEND_TO: your_email
            MAIL_USER: your_email_user
            MAIL_PASS: your_email_pass
        volumes:
        - ./mounted/logs:/go/src/lol-api/logs
        ports:
        - "8082:81"
  3. To launch the container and have the system running, execute the following command on the terminal:

    sudo docker-compose up --build -d

    This command will build the project, copy the resulting executable into the docker container and launch it

  4. To monitor the system is running, execute the following command which will display the logs

    sudo docker-compose logs -t -f

Callable routes

Those are the core resources of the REST API and the routes used to modify them

Resource Route Method Information Params
duos /api/v1/duo GET Returns the information of duos.
duos /api/v1/duo POST Create a new duo.
duos /api/v1/duo/ DELETE Delete a duo. collection_id
test /api/v1/5JUSUk/3fj48f GET Returns three items fron new collections.
test /api/v1/test GET Returns styng ideas of a user.
test /api/v1/test POST Creates test resource.
test /api/v1/test/ GET Returns test resource by id. collection_id
test /api/v1/test/ PATCH Updates test resource by id. collection_id
ideas /api/v1/test/ DELETE Deletes test resource. collection_id

License

Provide your license information here and link to your LICENSE.md file.

Citation

Explain how other people can cite your project.

Make sure you provide a BibTeX formatted reference e.g.:

@misc{yourlabel,
 author    = {Name of the authors},
 title     = {Your project's title},
 publisher = {Your publisher},
 year      = {2019},
}

Contact

Put here your contact details so contributors and team members can reach out to you if they have open questions (or want to compliment you).

Owner
Alberto García
There is always something new to learn and a better way to do things. That's why each day I aim to learn something.
Alberto García
Similar Resources

The official golang implementation for Project Anatha.

Project Anatha The official golang implementation for Project Anatha. For instructions on setting up a validator on the Anatha network, view the guide

Nov 25, 2021

Eh-godojo-1 - A Golang Dojo throwaway project

creates a go mod file out of git repo & provides a path to our projects like pac

Jan 25, 2022

In one particular project, i had to import some key/value data to Prometheus. So i have decided to create my custom-built Node Exporter in Golang.

In one particular project, i had to import some key/value data to Prometheus. So i have decided to create my custom-built Node Exporter in Golang.

In one particular project, i had to import some key/value data to Prometheus. So i have decided to create my custom-built Node Exporter in Golang.

May 19, 2022

Test-project - Lyrid Golang 1.x Chi Template

Lyrid Golang 1.x Chi Template Run locally with: go get go run ./main.go Open ht

Jan 31, 2022

A boilerplate/starter project for quickly building APIs using Golang with Clean Architechture

A boilerplate/starter project for quickly building APIs using Golang with Clean Architechture

A boilerplate/starter project for quickly building APIs using Golang with Clean Architechture

Mar 2, 2022

A small project for a simple chatroom using golang.

A small project for a simple chatroom using golang.

chatroom_go A small project for a simple chatroom using golang. 项目编码流程的设计分析 通讯逻辑示意图 客户端部分 客户端登录功能 1.接收的输入id和密码 2.接收服务端的返回结果 3.判断是成功还是失败,并显示对应的页面 客户端发送

Jul 3, 2022

Go API wrapper for Greenhouse.io API

Greenhouse IO A Go interface to Greenhouse.io's API Useage Creating the Client NewClient accepts: A context; used for any HTTP requests made using the

Jan 14, 2022

A Go project template

Powered by Cookiecutter, Cookiecutter Golang is a framework for jumpstarting production-ready go projects quickly.

Dec 26, 2022

Example programs for the Gio project.

Gio Examples Example programs for the Gio project. Issues File bugs and TODOs through the issue tracker or send an email to ~eliasnaur/[email protected].

Dec 20, 2022
Placeholder for the future project (lets-go-chat)Placeholder for the future project (lets-go-chat)

Placeholder for the future project (lets-go-chat)Placeholder for the future project (lets-go-chat)

Jan 10, 2022
A project that provides an in-memory key-value store as a REST API. Also, it's containerized and can be used as a microservice.

Easy to Use In-Memory Key-Value Store A project that provides an in-memory key-value store as a REST API. Also, it's containerized and can be used as

Mar 6, 2022
Golang-module-references - A reference for how to setup a Golang project with modules - Task Management + Math Examples

Golang Module Project The purpose of this project is to act as a reference for setting up future Golang projects using modules. This project has a mat

Jan 2, 2022
Basic-api-with-go - A basic api with golang

I am creating my first API with GO. Install go get -u github.com/Yefhem/basic-ap

Jan 3, 2022
GoLang Library for Browser Capabilities Project

Browser Capabilities GoLang Project PHP has get_browser() function which tells what the user's browser is capable of. You can check original documenta

Sep 27, 2022
:guardsman: A teeny tiny and somewhat opinionated generator for your next golang project

A Yeoman Golang Generator We are very sorry Gophers, but other names for the generator where taken, so we choose go-lang. But we have gocreate as an a

Sep 27, 2022
A sample golang project to demonstrate the integration with rancher pipeline

pipeline-example-go This is a sample golang project to demonstrate the integration with rancher pipeline. Building go build -o ./bin/hello-server Runn

Oct 30, 2021
A simple and sussy project is an implementation of SOMMIP Lab 1 written in Golang
A simple and sussy project is an implementation of SOMMIP Lab 1 written in Golang

SOMMIP Lab 1 Isac Arthur Table of Contents About The Project Getting Started Prerequisites Installation Supported commands About The Project This very

Nov 10, 2021
Cookiecutter for golang project

cookiecutter-golang Powered by Cookiecutter, Cookiecutter Golang is a framework for jumpstarting production-ready go projects quickly. Features Genero

Nov 18, 2021
GoLang Library for Browser Capabilities Project

Browser Capabilities GoLang Project PHP has get_browser() function which tells what the user's browser is capable of. You can check original documenta

Nov 23, 2021