39 lines
881 B
Go

package main
import (
"fmt"
"net/http"
"github.com/gin-gonic/gin"
swaggerFiles "github.com/swaggo/files"
ginSwagger "github.com/swaggo/gin-swagger"
_ "github.com/timetracker/backend/docs" // This line is important for swag to work
)
// @title Time Tracker API
// @version 1.0
// @description This is a simple time tracker API.
// @host localhost:8080
// @BasePath /
// @Summary Say hello
// @Description Get a hello message
// @ID hello
// @Produce plain
// @Success 200 {string} string "Hello from the Time Tracker Backend!"
// @Router / [get]
func helloHandler(c *gin.Context) {
c.String(http.StatusOK, "Hello from the Time Tracker Backend!")
}
func main() {
r := gin.Default()
r.GET("/", helloHandler)
r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
fmt.Println("Server listening on port 8080")
r.Run(":8080") // Use Gin's Run method
}