PatrickGTR / gta-open-web

A fullstack web application for GTA Open, consist of blog & user control panel written in Next JS, Go and MariaDB
https://gta-open.ga/
Apache License 2.0
13 stars 0 forks source link
fullstack golang mysql nextjs openmp reactjs sa-mp

GTA Open Web

Website / Control Panel made for GTA Open gamemode

Preview of the website ca be seen here: https://imgur.com/a/tN38jGx

Back end API

Endpoints

User

POST - /user/ User authentication (Login) recieves a json data

{
    "username": "username",
    "password": "password"
}

GET - /user/ Grabs all the registered account, statistics, and item data

GET - /user/{userid} Grabs account, statistics and item data

Server

GET - /server/stats Grabs the data dependong on option specified, available options are 1 -> most kills, 2 -> most money, 3 -> most deaths

GET - /server/banlist Retrieves all the banned accounts

Media

POST - /media/ Creates a new media entry

{
    "youtubeLink": "Link",
    "title": "Title"
}

POST - /media/add_views increments views of a post

{
    "mediaid": "id",
}

POST - /media/comment/ Creates a new comment entry

{
    "mediaid": "id",
    "comment": "hello world"
}

GET - /media/comment/{id} Retrieves all the comments of the specified media id

GET - /media/ Retrieves all data of a posted media

GET - /media/{id} Retrieves the data of the specified media

GET - /media/trending/ Retrieves the data of the 'trending' post, takes a parameter q(uery), available options are hottest and newest

Front end

How to build

Development

Fill and add the following environment variables

SECRET_KEY=""
MYSQL_USERNAME=""
MYSQL_DATABASE=""
MYSQL_PASSWORD=""
MYSQL_SERVER=""
ENV="ENV"

and run...

cd front-end
npm run dev

cd ..

cd back-end
go run main.go

Production

Fill and add the following environment variables

SECRET_KEY=""
MYSQL_USERNAME=""
MYSQL_DATABASE=""
MYSQL_PASSWORD=""
MYSQL_SERVER=""
ENV="PROD"

and run...

docker-compose up