update auth.go, database.go, docs.go, forum.go, go.mod, go.sum, main.go, post_schema.go, role.go, server.go, service.go, swagger.json, swagger.yaml, thread_schema.go

This commit is contained in:
redtea committed 2024-10-21 12:00:00 +03:00
1 parent 42c7f5795d
commit 43505548f7
14 files changed
+855

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
package esforum
import (
"context"
"net/http"
"time"
"github.com/sirupsen/logrus"
)
type Server struct {
httpServer *http.Server
}
func (s *Server) Run(port string, handler http.Handler) error {
s.httpServer = &http.Server{
Addr: ":" + port,
Handler: handler,
MaxHeaderBytes: 1 << 20,
ReadTimeout: 10 * time.Second,
WriteTimeout: 10 * time.Second,
}
logrus.Info("running server...")
return s.httpServer.ListenAndServe()
}
func (s *Server) Shutdown(ctx context.Context) error {
return s.httpServer.Shutdown(ctx)
}