feat: file uploads
This commit is contained in:
19
server/internal/handlers/client.go
Normal file
19
server/internal/handlers/client.go
Normal file
@ -0,0 +1,19 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"io/fs"
|
||||
"log"
|
||||
"net/http"
|
||||
|
||||
"github.com/spotdemo4/trevstack/server/internal/interceptors"
|
||||
)
|
||||
|
||||
func NewClientHandler(client embed.FS, key string) http.Handler {
|
||||
clientFs, err := fs.Sub(client, "client")
|
||||
if err != nil {
|
||||
log.Fatalf("failed to get sub filesystem: %v", err)
|
||||
}
|
||||
|
||||
return interceptors.WithAuthRedirect(http.FileServer(http.FS(clientFs)), key)
|
||||
}
|
Reference in New Issue
Block a user