ganggas95 / peken-be

This project only for learn go with gin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PEKEN Backend

This app is for learning purpose. Here I will learn about Golang with Gin Web Framework

Requirements

  • Golang
  • PostgreSQL

Environtment

To prepare the environment for building and running the application, please follow these steps:

  • Create a new file with the name .env.
  • Copy all the variables from the .baseEnv file.
  • Paste the copied variables into the .env file.
  • Edit the values of the variables in the .env file to match your configuration.

This will ensure that the application is properly configured before building and running it.

Project Structure

In this project, I'm using MVC structure with Dependency Injection support using Google Wire library. Here is the structure that I used:

Structure

Source Image from: https://medium.com/@adamszpilewicz/golang-web-application-with-mvc-like-structure-using-gin-and-pgx-dc19132adc12

Generate generated file wire_gen.go

As I mention before, this project running with Dependency Injection support using Google Wire library. Before we run the application, we must generate the wire_gen.go. Every changed files that we made that configured in injector.go, we must run this command:

$ wire

Build, Run and Run Test

Building the application

$ make build

Running the application

$ make run-dev

Running the test case

$ make run-test

About

This project only for learn go with gin


Languages

Language:Go 99.2%Language:Makefile 0.8%