HTTP server was reorganised in internal/http.
This commit is contained in:
parent
3d8ee35053
commit
bdcdecb612
@ -1,8 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"dwelling-files/internal/handlers"
|
||||
"dwelling-files/internal/server"
|
||||
"dwelling-files/internal/http"
|
||||
"dwelling-files/web"
|
||||
"flag"
|
||||
"fmt"
|
||||
@ -47,8 +46,8 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
hand := handlers.New(directoryPath, web.Assets(), !*enableFileHandler)
|
||||
srv := server.NewHttpServer()
|
||||
hand := http.New(directoryPath, web.Assets(), !*enableFileHandler)
|
||||
srv := http.NewHttpServer()
|
||||
|
||||
srv.GET("/*filepath", hand.Index)
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
package handlers
|
||||
package http
|
||||
|
||||
import (
|
||||
"dwelling-files/internal/server"
|
||||
"dwelling-files/pkg/files"
|
||||
"dwelling-files/pkg/utils"
|
||||
"dwelling-files/web"
|
||||
@ -38,7 +37,7 @@ func (FilesHandlers) AssetsFS() http.FileSystem {
|
||||
}
|
||||
|
||||
func (h *FilesHandlers) Index(w http.ResponseWriter, r *http.Request) {
|
||||
path := httprouter.CleanPath(server.GetURLParam(r, "filepath"))
|
||||
path := httprouter.CleanPath(GetURLParam(r, "filepath"))
|
||||
|
||||
if strings.HasPrefix(path, "/assets") {
|
||||
h.assetsServer.ServeHTTP(w, r)
|
@ -1,4 +1,4 @@
|
||||
package server
|
||||
package http
|
||||
|
||||
import (
|
||||
"context"
|
Loading…
Reference in New Issue
Block a user