Skip to content

pasan1/GoLang-Gin-CRUD-App-using-MySQL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GoLang Gin CRUD App using MySQL

Installation

go get github.com/pasan1/GoLang-Gin-CRUD-App-using-MySQL

Usage

go run main.go

API Endpoints

Get All Users

GET /users

Save User

POST /users

Author

Pasan Abeysekara

Structure

├── app
│   ├── controllers
│   │   └── user_controller.go
│   ├── models
│   │   └── user_model.go
│   ├── repositories
│   │   └── user_repository.go
│   ├── routes
│   │   └── router.go
│   └── main.go
├── config
│   └── database.go
├── go.mod
└── go.sum

Usage of the structure

  1. app/controllers: This folder contains the controllers responsible for handling HTTP requests and defining the application's behavior. In this example, we have a user_controller.go file.
  2. app/models: This folder contains the model definitions for your application. Here, we have a user_model.go file.
  3. app/repositories: This folder contains the repository layer that interacts with the database. In this example, we have a user_repository.go file.
  4. app/routes: This folder contains the router configuration for your application. Here, we have a router.go file.
  5. app/main.go: This is the entry point of your application. It initializes the server and sets up the routes.
  6. config/database.go: This file contains the configuration details for connecting to your MySQL database.
  7. go.mod and go.sum: These files manage the Go modules and their dependencies.

Contact

Email: contact@pasanabeysekara.com
Website: https://pasanabeysekara.com
LinkedIn: https://www.linkedin.com/in/pasanabeysekara

About

GoLang and Gin CRUD application using a MySQL database

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages