Experiment with Authentication and Websockets
Some checks failed
build-docker-imge / Build the docker container (push) Failing after 2m24s
Some checks failed
build-docker-imge / Build the docker container (push) Failing after 2m24s
This commit is contained in:
28
main.go
Normal file
28
main.go
Normal file
@ -0,0 +1,28 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"git.kocoder.xyz/kocoded/szuntis-backend/auth"
|
||||
"git.kocoder.xyz/kocoded/szuntis-backend/middleware"
|
||||
"git.kocoder.xyz/kocoded/szuntis-backend/router"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// dsn := "postgresql://app1:p5ohxMubZHhzsvSQevlFfw@cockroach-db-1-11072.7tc.aws-eu-central-1.cockroachlabs.cloud:26257/defaultdb?sslmode=verify-full"
|
||||
// db, err := gorm.Open(postgres.Open(dsn), &gorm.Config{})
|
||||
// if err != nil {
|
||||
// log.Fatal("failed to connect database", err)
|
||||
// }
|
||||
|
||||
ar := auth.NewMemeoryAuthRepository()
|
||||
app := fiber.New()
|
||||
|
||||
api := app.Group("/api")
|
||||
router.NewAuthRouter(ar, middleware.NewAuthMiddleware(ar), api.Group("auth"))
|
||||
router.NewWebSocketRouter(middleware.NewWsMiddleware(), api.Group("web"))
|
||||
api.Use(middleware.NewWsMiddleware().IsWebscoketUpgrade)
|
||||
|
||||
log.Fatal(app.Listen(":3000"))
|
||||
}
|
||||
Reference in New Issue
Block a user