Skip to content

tkdtn2013/gogen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gogen

CLI tool to generate Go REST API projects using Gin.

Features:

  • Automatically sets up Swagger documentation.
  • Configures a MariaDB database using Gorm.
  • Supports HTTPS when SSL_CERT_FILE and SSL_KEY_FILE are provided.

Usage

gogen create myapp
cd myapp
export DB_DSN="user:password@tcp(localhost:3306)/app?charset=utf8mb4&parseTime=True&loc=Local"
export SSL_CERT_FILE=/path/to/server.crt
export SSL_KEY_FILE=/path/to/server.key
go run cmd/main.go

The generated project will include Swagger and database setup. Provide the MariaDB connection string via the DB_DSN environment variable. If not set, a default DSN connecting to localhost:3306 will be used.

To enable HTTPS during development, set SSL_CERT_FILE and SSL_KEY_FILE to the paths of your certificate and private key.

About

go generate rest api cli

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors