Team Demerzel is a HNG X Backend team of Go Developers. This project is an API for an 'Events' Mobile Application built by Team Demerzel - Mobile.
The API from this project is fully Documented HERE
- Golang v >= 1.19
- Mysql v >= 8.0
Your Repo's found at https://github.com/hngx-org/Demerzel-events-backend So to work with Forks you basically:
- Fork your Team Repo to your personal Github account
- Pull the code back to your local Machine
- Checkout to your assignment branch
- Do your thing
- Push back to your Personal Github Repo. That'll be your 'ORIGIN' remote (not the 'UPSTREAM' remote)
- You head over to Github and Create a Pull request to the Main Repository's branch
- Remember a Pull Request can contain multiple commits. That's it. Here's a video to help further.
Additional help
- To clone repo from your account
git clone https://github.com/{your username}/Demerzel-events-backend
- Create a .env file
cp .env.example .env
- Edit File with the following approriate values
APP_ENV=app-env
PORT=app-port
MYSQL_HOST=your-db-hostname
MYSQL_PORT=your-db-port
MYSQL_USERNAME=your-db-username
MYSQL_PASSWORD=your-db-password
MYSQL_DBNAME=your-db-name
GOOGLE_CLIENT_ID=google-client-id
GOOGLE_CLIENT_SECRET=google-client-secret
GOOGLE_CALLBACK_URL=google-callback-url
JWT_SECRET=jwt-secret
- Run server
go run main.go
To run the API in a container, you'll need to set the following environment variables:
APP_ENV
: The current Application environment ('local' or 'prod').PORT
: Access port for the API App.MYSQL_HOST
: Hostname of the MySQL database server.MYSQL_PORT
: Port of the MySQL database server.MYSQL_USERNAME
: MySQL database username.MYSQL_PASSWORD
: MySQL database password.MYSQL_DBNAME
: Name of the MySQL database.GOOGLE_CLIENT_ID
: Google OAuth Client_IDGOOGLE_CLIENT_SECRET
: Google OAuth Client SecretGOOGLE_CALLBACK_URL
: Google OAuth Callback URLJWT_SECRET
: JWT Secret key.
-
Build the Docker image: Replace {repo_access_key} with the approriate Repository access key.
docker build -t your-api-image --build-arg="ACCESS_KEY={repo_access_key}" . docker run -d -p 8080:8080 \ -e APP_ENV=app-env \ -e PORT=app-port \ -e MYSQL_HOST=your-db-hostname \ -e MYSQL_PORT=your-db-port \ -e MYSQL_USERNAME=your-db-username \ -e MYSQL_PASSWORD=your-db-password \ -e MYSQL_DBNAME=your-db-name \ -e GOOGLE_CLIENT_ID=google-client-id \ -e GOOGLE_CLIENT_SECRET=google-client-secret \ -e GOOGLE_CALLBACK_URL=google-callback-url \ -e JWT_SECRET=jwt-secret \ --name your-container-name \ your-api-image
The API should now be accessible at http://localhost:8080
- This repository contains Github Actions workflow that builds the App into a Docker image and uploads it to a private Azure Container Registry instance.