kit/pkg/web2/server.go

30 lines
546 B
Go
Raw Normal View History

2023-08-30 13:58:44 +00:00
package web2
import (
"github.com/gofiber/fiber/v2"
"github.com/jinzhu/gorm"
"github.com/sirupsen/logrus"
)
type Server struct {
db *gorm.DB
log *logrus.Logger
router *fiber.App
}
// NewServer is a constructor for Server struct
// It takes a database connection and a logger as parameters
// It returns a pointer to a Server struct
func NewServer(db *gorm.DB, log *logrus.Logger) *Server {
app := fiber.New()
return &Server{
db: db,
log: log,
router: app,
}
}
func (s *Server) Run() {
s.router.Listen(":3000")
}