Golang Portofolio Project: RESTful API For Online Learning Application
- Go: 1.19.3^
- MySQL : 8.0.32^
- Wire: 0.5.0^
Information about database migration and seeder.
All the route of the api.
Configuration file that loaded in form of struct from env file.
Directory for the functions to process request from registered routes.
Dependency injection for making automation in function provider.
Error handling from the api failed request.
Small functions like converter, panic helper, etc.
Objects that interprets the model in the database and formats the request or response.
Layer that handling logic interaction with the database.
Layer for handling main business login of the request routes.
Integration tests for all the api.
- First we need to clone the repo into our local machine
git clone https://github.com/FikranAkbar/online-learning-restful-api.git
- then move to folder just created
cd online-learning-restful-api/
- then download all the required package
go mod tidy
Run Project in Development Environment
go run main.go
Configuration file is write using environment variables. This file must be exists in root directory with complete example file as below:
#filename: app.env
DB_HOST= <<YOUR DB HOST>>
DB_PORT= <<YOUR DB PORT>>
DB_USER= <<YOUR DB USER>>
DB_PASSWORD= <<YOUR DB PASSWORD>>
DB_NAME= <<YOUR DB NAME>>
DB_NAME_FOR_TEST= <<YOUR DB TEST NAME>>
MIDTRANS_CLIENT_KEY= <<YOUR MIDTRANS CLIENT KEY>>
MIDTRANS_SERVER_KEY= <<YOUR MIDTRANS SERVER KEY>>
-
Make file app.env and copy content from example.env
-
Update the app.env fields based on your local
-
Run the test in app/database/db_test.go
go test app/database/db_test.go
- Authentication
- Course (Module, Webinar, Quiz)
- Expert Mentor
- Industry Insight Article
- Payment (Course Transaction)