diff options
author | Gabriel Arakaki Giovanini <mail@gabrielgio.me> | 2023-08-05 19:26:29 +0200 |
---|---|---|
committer | Gabriel Arakaki Giovanini <mail@gabrielgio.me> | 2023-08-05 19:26:29 +0200 |
commit | 5168a9476f0e83264ecafc85bc9145e8bdcbb8dc (patch) | |
tree | 5cd04e84f8aa427d274e16dd8cf507ff48468e07 /pkg/worker | |
parent | 24c121a9ef229870f54de487de01c15a15ebbff1 (diff) | |
download | lens-5168a9476f0e83264ecafc85bc9145e8bdcbb8dc.tar.gz lens-5168a9476f0e83264ecafc85bc9145e8bdcbb8dc.tar.bz2 lens-5168a9476f0e83264ecafc85bc9145e8bdcbb8dc.zip |
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.
Diffstat (limited to 'pkg/worker')
-rw-r--r-- | pkg/worker/httpserver.go | 15 |
1 files changed, 5 insertions, 10 deletions
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, } |