This commit is contained in:
kandrusyak
2023-07-25 00:57:36 +03:00
parent 2ab8622141
commit 31fcc2863d

13
main.go
View File

@@ -31,14 +31,19 @@ func main() {
e.Use(mw.TokenFromCookies)
e.Use(mw.JWT_MW)
e.Use(func(next echo.HandlerFunc) echo.HandlerFunc {
return func(c echo.Context) error {
if c.Request().Method == http.MethodOptions {
return c.NoContent(http.StatusOK)
}
return next(c)
}
})
e.Pre(middleware.RemoveTrailingSlash())
mainGroup := e.Group("/api")
mainGroup.OPTIONS("/*", func(c echo.Context) error {
return c.NoContent(http.StatusOK)
})
// Routes
mainGroup.GET("/*", checkAuth)
mainGroup.GET("/health", handler.Health)