forked from mirrors/pkg-proxy
16 lines
297 B
Go
16 lines
297 B
Go
|
|
package server
|
||
|
|
|
||
|
|
import (
|
||
|
|
"embed"
|
||
|
|
"io/fs"
|
||
|
|
"net/http"
|
||
|
|
)
|
||
|
|
|
||
|
|
//go:embed static/*
|
||
|
|
var staticFiles embed.FS
|
||
|
|
|
||
|
|
// staticHandler returns an http.Handler that serves embedded static files.
|
||
|
|
func staticHandler() http.Handler {
|
||
|
|
sub, _ := fs.Sub(staticFiles, "static")
|
||
|
|
return http.FileServer(http.FS(sub))
|
||
|
|
}
|