feat: add docs

This commit is contained in:
2025-11-02 22:29:24 -03:00
parent 3b1b05d5a6
commit 92f13fba22
7 changed files with 1070 additions and 8 deletions

40
cmd/server/main.go Normal file
View File

@@ -0,0 +1,40 @@
package main
import (
"log"
"net/http"
_ "gitea.gabilandia.com/gabdlr/agenda-web-go/docs"
"gitea.gabilandia.com/gabdlr/agenda-web-go/internal/database"
"gitea.gabilandia.com/gabdlr/agenda-web-go/internal/handler"
"gitea.gabilandia.com/gabdlr/agenda-web-go/internal/repository"
httpSwagger "github.com/swaggo/http-swagger"
)
// @title Contacts API
// @version 1.0
// @description A simple Contacts CRUD API
// @termsOfService http://swagger.io/terms/
// @contact.name API Support
// @contact.email support@yourapp.com
// @license.name MIT
// @license.url https://opensource.org/licenses/MIT
// @host localhost:8080
// @BasePath /
func main() {
err := database.InitDB(database.Conn_string)
defer database.CloseDB()
if err != nil {
log.Fatal("Database connection failed:", err)
}
mux := http.NewServeMux()
contactRepo := repository.NewContactRepository(database.DB)
handler.HandleContacts(mux, contactRepo)
handler.HandlHealthChecks(mux)
mux.HandleFunc("/swagger/", httpSwagger.WrapHandler)
log.Fatal(http.ListenAndServe(":8080", mux))
}