modulepackage
0.0.0-20241222044017-5d085aa8d68f
Repository: https://github.com/hyperjiang/gin-skeleton.git
Documentation: pkg.go.dev
# README
gin-skeleton
Gin Skeleton is a simple boilerplate to kickstart a web server project based on Gin Framework.
Require go version >= 1.18, if your go version is lower, please use legacy branches, there are quite a lot of incompatible changes between master and legacy branches.
# start a web server listening on 0.0.0.0:8080
go run main.go
Components
- Framework: gin-gonic/gin
- Database ORM: go-gorm/gorm
- Database migration: rubenv/sql-migrate
- Zero Allocation JSON Logger: rs/zerolog
- YAML support: go-yaml/yaml
- Testing toolkit: stretchr/testify
Configuration
Edit the config.yml
with your own config
Database Migration
Create the database first
CREATE DATABASE IF NOT EXISTS `gin` DEFAULT CHARACTER SET utf8mb4;
Migrates the database to the most recent version available
./migrate.sh up
Undo a database migration
./migrate.sh down
Show migration status
./migrate.sh status
Create a new migration
./migrate.sh new a_new_migration
Available endpoints
See router
-
Home page: http://localhost:8080/
-
Api version: http://localhost:8080/api/version
-
Sign up: http://localhost:8080/signup
-
Login: http://localhost:8080/login
-
Get user info: http://localhost:8080/user/1
-
Test jwt: http://localhost:8080/auth/hello (only user "admin" can see this page)
# Packages
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author