Files
tp/main_dc/yalarba/api_yal/internal/handlers/auth.go
T
valitovgaziz bc18d02935 modified: Dockerfile
new file:   bin/api_yal
	new file:   cmd/main.go
	new file:   go.mod
	new file:   internal/handlers/auth.go
	new file:   internal/server/server.go
add server, files, dockerfile, build
2026-01-30 04:41:27 +05:00

31 lines
867 B
Go

package handlers
import (
"net/http"
)
// AuthHandler обработчик для аутентификации
type AuthHandler struct{}
// NewAuthHandler создает новый экземпляр AuthHandler
func NewAuthHandler() *AuthHandler {
return &AuthHandler{}
}
// HandleAuth обрабатывает GET запросы на /auth
func (h *AuthHandler) HandleAuth(w http.ResponseWriter, r *http.Request) {
if r.Method != http.MethodGet {
http.Error(w, "Method not allowed", http.StatusMethodNotAllowed)
return
}
// Возвращаем статус 200 OK
w.WriteHeader(http.StatusOK)
w.Write([]byte("OK"))
}
// RegisterAuthRoutes регистрирует маршруты для аутентификации
func RegisterAuthRoutes(mux *http.ServeMux) {
authHandler := NewAuthHandler()
mux.HandleFunc("/auth", authHandler.HandleAuth)
}