yaxc/internal/server/server.go

21 lines
432 B
Go
Raw Normal View History

2021-03-24 23:11:23 +08:00
package server
2021-03-24 23:33:28 +08:00
import "github.com/gofiber/fiber/v2"
2021-03-24 23:11:23 +08:00
func (s *yAxCServer) Start() {
log.Info("Starting YAxC server on", s.BindAddress)
s.App = fiber.New()
// register routes
s.App.Get("/", func(ctx *fiber.Ctx) error {
return ctx.SendString(body)
})
s.App.Get("/:anywhere", s.handleGetAnywhere)
s.App.Post("/:anywhere", s.handlePostAnywhere)
if err := s.App.Listen(s.BindAddress); err != nil {
log.Critical(err)
}
}