Skip to content

shj1081/toy-db-module

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DB Module with Golang

Prerequisites

  • Go 1.21 or higher
  • MySQL Server

Setup & Configuration

  1. Clone the repository

  2. Install dependencies (not necessary):

    make setup
  3. Set up environment variables by copying following .env.example to .env:

    # .env.example
    # DB
    DB_DSN=root:1234@tcp(localhost:3306)/ # need tcp declaration
    DB_MAX_CONNS=25
    DB_MAX_IDLE_CONNS=25
    DB_CONN_MAX_LIFETIME=10m
    
    # Server
    PORT=8080
    ENV=development # adjust logging level by environment
    
    # Auth
    AUTH_PROXY_URL=http://localhost:8080/validate
  4. Run the development server with hot reload (auto install dependencies):

    make dev
  5. Build for production (auto install dependencies):

    make build
  6. Run server (auto install dependencies):

    make run

Swagger API Docs

after running the server, go to

http://localhost:8080/swagger/index.html

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published