added logout

This commit is contained in:
Mephimeow
2026-06-12 10:18:04 +00:00
committed by zero@thinky
parent a822d8c3b6
commit f1308b3be7
11 changed files with 244 additions and 5 deletions
+2 -1
View File
@@ -38,7 +38,7 @@ func main() {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
client, err := mongo.Connect(options.Client().ApplyURI(cfg.MongoURI))
client, err := mongo.Connect(options.Client().ApplyURI(cfg.MongoURI).SetTimeout(10 * time.Second))
if err != nil {
log.Fatalf("failed to create mongodb client: %v", err)
}
@@ -77,6 +77,7 @@ func main() {
api.POST("/register", handler.Register)
api.POST("/login", handler.Login)
api.POST("/refresh", handler.Refresh)
api.POST("/logout", handler.Logout)
api.GET("/me", auth.AuthMiddleware([]byte(cfg.JWTSecret)), handler.Me)
}