go web skeleton
1.0.0
Ein komplettes Golang -Web -Anwendungsskelett.
中文说明
Enthält:
gookit/slog -Konfiguration verwendetgo mod , um die Verwaltungsabhängigkeiten zu installieren Github-Projekt https://github.com/inhere/go-web-skeletton
api/ API interface application handlers
|- controller/
|- middleware/
|_ routes.go
app/ Common directory (public methods, application initialization, public components, etc.)
cmd/ CLI command line application commands
|_ cliapp/ command line application entry file (main)
config/ Application configuration directory (basic configuration plus various environment configurations)
model/ Data and logic code directory
|- form/ Request form structure data definition, form validation configuration
|- logic/ Logic processing
|- mongo/ MongoDB data collection model definition
|- mysql/ MySQL data form model definition
|_ rds/ Redis data model definition
resource/ Non-code resources used by some projects (language files, view template files, etc.)
runtime/ Temporary file directory (file cache, log files, etc.)
static/ Static resource directory (js, css, etc.)
main.go Web application entry file
Dockerfile Dockerfile
Makefile Has written some common shortcut commands to help package, build docker, generate documentation, run tests, etc.
...
durch
tree -d 2 ./
Verwenden Sie ✅ markieren Sie aktuelles GO -Paket
Bieten Sie HTTP -Service und Routing an
Andere :
Befehlszeilenanwendung
Konfigurationsverwaltung
MySQL:
MongoDB:
Redis:
Datenvalidierung anfordern
Hochleistungs-Serialisierungsbibliothek
JSON:
Konfigurationsregisterzentrum:
Dockerfile : Docker Image Build -Skript für die Produktionsumgebung basierend auf Alpine, erstellen Sie ein Projektbild mit einer geschätzten Größe von etwa 30 mmakefile : Es wurden einige schnelle Make-Befehle erstellt, um schnell Dokumentationen zu generieren und Bilder zu erstellen. go-web-skeleton Verzeichnis in Ihren Projektnamen um.github.com/inhere/go-web-skeleton durch Ihren Projektnamen (für Go-Datei)go-web-skeleton durch Ihren Projektnamen (hauptsächlich Dockerfile, Makefile)go mod tidy , um abhängige Bibliotheken zu installierengo run main.gogo run ./cmd/appinitInstallation:
go get -u github.com/swaggo/swag/cmd/swagBitte überprüfen Sie die Dokumentation und Beispiele von
swaggo/swag
Generiert in das angegebene Verzeichnis:
swag init -o static
# This file will be generated at the same time. It can be deleted if it is not needed.
rm static/docs.goBeachten:
swaggo/swagist die Analyse -Feldbeschreibungsinformationen aus dem Kommentar des Feldes
type SomeModel struct {
// the name description
Name string `json:"name" example:"tom"`
} Go test
// output coverage
Go test -covergofmt -s -l ./
go fmt ./...Hinweis: Sie müssen zuerst
GoLintinstallieren.
golint ./...MIT