33 lines
578 B
Go
Executable File
33 lines
578 B
Go
Executable File
package http
|
|
|
|
import (
|
|
"actatempus_backend/internal/infrastructure/config"
|
|
"fmt"
|
|
"net/http"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
type Server struct {
|
|
cfg *config.Config
|
|
}
|
|
|
|
func NewServer(cfg *config.Config) *Server {
|
|
return &Server{cfg: cfg}
|
|
}
|
|
|
|
func (s *Server) Start() error {
|
|
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
|
fmt.Fprintln(w, "Welcome to ActaTempus!")
|
|
})
|
|
|
|
r := gin.Default()
|
|
r.GET("/ping", func(c *gin.Context) {
|
|
c.JSON(http.StatusOK, gin.H{
|
|
"message": "pong",
|
|
})
|
|
})
|
|
|
|
return r.Run()
|
|
}
|