Backend for OneNUS
.
You can find the live version of this project here.
You can find the frontend that consumes this project here.
Project aspect | Technologies used |
---|---|
Frontend | Typescript + React |
Backend (this repo) | Golang + Gin + Gorm See ⚡️Technologies for more details. |
Database | MySQL |
Deployment plan | Frontend: AWS S3 Bucket + Cloudfront See Frontend Deployment for more details. Backend: AWS EC2 + Nginx (reverse proxy) See 🌐 Deployment for more details. Database: AWS EC2 (same instance as backend) |
-
Go
Install Go if you have not done so yet.
-
Clone this repo.
$ git clone https://github.com/mfjkri/OneNUS-Backend.git
-
Change into the repo directory.
$ cd OneNUS-Backend
-
Copy the template
.env
file.$ cp .env.example .env
Modify the following environment variables in the new
.env
file accordingly:PORT=8080 # Port number that the project will be listening to DB="USERNAME:PASSWORD@tcp(HOSTNAME:PORT_NUMBER)/DATABASE_NAME?charset=utf8mb4&parseTime=True&loc=Local" # Credentials to connect to database JWT_SECRET=JWT_SECRET # Random string that is used to generate JWT tokens GIN_MODE="debug" # Set to either "debug" or "release" accordingly
-
All set!
$ go run main.go
This command will install all dependencies automatically when first ran.