From 5168a9476f0e83264ecafc85bc9145e8bdcbb8dc Mon Sep 17 00:00:00 2001 From: Gabriel Arakaki Giovanini Date: Sat, 5 Aug 2023 19:26:29 +0200 Subject: ref: Move net/http I was young and naive, fasthttp does not fit my needs and make development slower. I'll move to net/http since it has a wider support and will spare some time on implementation detail things (like CSRF). It will allow me to reduce a bit of the code since there may be lib for handling cookie encryption and auth in general. --- pkg/worker/httpserver.go | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'pkg/worker') diff --git a/pkg/worker/httpserver.go b/pkg/worker/httpserver.go index 181cf73..dc8f255 100644 --- a/pkg/worker/httpserver.go +++ b/pkg/worker/httpserver.go @@ -2,29 +2,24 @@ package worker import ( "context" - - "github.com/valyala/fasthttp" + "net/http" ) type ServerWorker struct { - server *fasthttp.Server + server *http.Server } func (self *ServerWorker) Start(ctx context.Context) error { go func() { // nolint: errcheck - self.server.ListenAndServe("0.0.0.0:8080") + self.server.ListenAndServe() }() <-ctx.Done() - return self.Shutdown() -} - -func (self *ServerWorker) Shutdown() error { - return self.server.Shutdown() + return self.server.Shutdown(ctx) } -func NewServerWorker(server *fasthttp.Server) *ServerWorker { +func NewServerWorker(server *http.Server) *ServerWorker { return &ServerWorker{ server: server, } -- cgit v1.2.3