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 /cmd | |
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 'cmd')
-rw-r--r-- | cmd/server/main.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/cmd/server/main.go b/cmd/server/main.go index 385c54f..39987e5 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -4,13 +4,13 @@ import ( "context" "encoding/hex" "errors" + "net/http" "os" "os/signal" - "github.com/fasthttp/router" + "github.com/gorilla/mux" "github.com/sirupsen/logrus" flag "github.com/spf13/pflag" - "github.com/valyala/fasthttp" "gorm.io/driver/mysql" "gorm.io/driver/postgres" "gorm.io/driver/sqlite" @@ -71,8 +71,8 @@ func main() { panic("failed to decode key database: " + err.Error()) } - r := router.New() - r.GET("/static/{filepath:*}", ext.FileServer(static.Static)) + r := mux.NewRouter() + r.PathPrefix("/static/").Handler(http.StripPrefix("/static/", http.FileServer(http.FS(static.Static)))) // repository var ( @@ -122,7 +122,7 @@ func main() { // worker var ( - serverWorker = worker.NewServerWorker(&fasthttp.Server{Handler: r.Handler, NoDefaultContentType: true}) + serverWorker = worker.NewServerWorker(&http.Server{Handler: r, Addr: "0.0.0.0:8080"}) fileWorker = worker.NewWorkerFromChanProcessor[string]( fileScanner, scheduler, |