Инициализация проекта + первые наработки

This commit is contained in:
Ганеев Артём
2025-01-04 10:42:04 +03:00
commit def3552a67
8 changed files with 248 additions and 0 deletions

27
internal/AuthServer.go Normal file
View File

@@ -0,0 +1,27 @@
package internal
import (
"context"
"net/http"
"time"
)
type Server struct {
httpServer *http.Server
}
func (s *Server) Run(port string,handler http.Handler) error {
s.httpServer = &http.Server{
Addr: ":" + port,
Handler: handler,
ReadTimeout: 10 * time.Second,
WriteTimeout: 10 * time.Second,
MaxHeaderBytes: 1 << 20,
}
return s.httpServer.ListenAndServe()
}
func (s *Server) Shutdown(ctx context.Context) error{
return s.httpServer.Shutdown(ctx)
}