-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
28 lines (23 loc) · 846 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package main
import (
"github.com/fazriachyar/go-auth/auth"
"github.com/fazriachyar/go-auth/controllers"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
)
func main() {
e := echo.New()
e.GET("/user/signin", controllers.SignInForm()).Name = "userSignInForm"
e.POST("/user/signin", controllers.SignIn())
adminGroup := e.Group("/admin")
adminGroup.Use(middleware.JWTWithConfig(middleware.JWTConfig{
Claims: &auth.Claims{},
SigningKey: []byte(auth.GetJWTSecret()),
TokenLookup: "cookie:access-token",
ErrorHandlerWithContext: auth.JWTErrorChecker,
}))
adminGroup.GET("", controllers.Admin())
// e.GET("/user/signin", controllers.SignInForm()).Name = "userSignInForm"
// e.POST("/user/signin", controllers.SignIn())
e.Logger.Fatal(e.Start(":1337"))
}