This is a GoLang backend application that provides APIs for data collection from the frontend and database management.
- Check if the database exists
- Insert collected data into the database
- Check if a user is banned
This application requires the following dependencies:
- GoLang v1.16 or later
- PostgreSQL database
- Install GoLang v1.16 or later and PostgreSQL database (locally or remotely).
- Clone the repository and navigate to the project directory.
- Run the following command to install dependencies:
go get ./...- Create a .env file with the following environment variables:
DB_NAME=<database name>
DB_USER=<database username>
DB_PASSWORD=<database password>
DB_HOST=<database host>
DB_PORT=<database port>- Run the application using the following command:
cd ./cmd/backend-microservice/
GO11MODULE=off GOOS=linux go build -race -ldflags "-extldflags '-static'" -o ./zehd-backend
sudo chmod +x ./zehd-backend
./zehd-backendAPI endpoint: `/database/exist`
Method: `GET`
- `200 OK` if the database exists
- `500 Internal Server Error` if the database does not exist
API endpoint: `/api/collect`
Method: `POST`
Request body: Please refer to the frontend for the body
- `200 OK` if data is inserted successfully
- `400 Bad Request` if the request is malformed
API endpoint: `/api/banned`
Method: `GET`
Query parameter: This is still a Work In Progress
- `200 OK` with the banned user’s information if the user is banned
- `404 Not Found` if the user is not banned
Contributions to this project are welcome. To contribute, please follow these steps:
- Fork this repository.
- Create a new branch.
- Make your changes and commit them with descriptive commit messages.
- Push your changes to your forked repository.
- Create a pull request to the original repository.