Skip to content

Golang Portofolio Project: RESTful API For Online Learning Application

Notifications You must be signed in to change notification settings

FikranAkbar/online-learning-restful-api

Repository files navigation

Online Learning RESTful API

Golang Portofolio Project: RESTful API For Online Learning Application

Table of Contents

  1. Built With
  2. Project Structure
  3. Getting Started
  4. Deployment and Documentation
  5. Features Roadmap

Built With

  • Go: 1.19.3^
  • MySQL : 8.0.32^
  • Wire: 0.5.0^

(back to table of contents)

Project Structure

/app/database

Information about database migration and seeder.

/app/router

All the route of the api.

/config

Configuration file that loaded in form of struct from env file.

/controller

Directory for the functions to process request from registered routes.

/di

Dependency injection for making automation in function provider.

/exception

Error handling from the api failed request.

/helper

Small functions like converter, panic helper, etc.

/model

Objects that interprets the model in the database and formats the request or response.

/repository

Layer that handling logic interaction with the database.

/service

Layer for handling main business login of the request routes.

/test

Integration tests for all the api.

(back to table of contents)

Getting Started

Prerequisites

  1. First we need to clone the repo into our local machine
git clone https://github.com/FikranAkbar/online-learning-restful-api.git
  1. then move to folder just created
cd online-learning-restful-api/
  1. then download all the required package
go mod tidy

Run Project in Development Environment

go run main.go

Environment Variables

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>>

Database Migration

  1. Make file app.env and copy content from example.env

  2. Update the app.env fields based on your local

  3. Run the test in app/database/db_test.go

go test app/database/db_test.go

(back to table of contents)

Documentation

(back to table of contents)

Features Roadmap

  • Authentication
  • Course (Module, Webinar, Quiz)
  • Expert Mentor
  • Industry Insight Article
  • Payment (Course Transaction)

(back to table of contents)

Releases

No releases published

Packages

No packages published