mirror of
https://github.com/bitvora/wot-relay.git
synced 2025-04-19 18:21:18 +00:00
ability to serve any file from /static/
This commit is contained in:
parent
559d0ca1f4
commit
489e51e274
7
main.go
7
main.go
@ -112,6 +112,11 @@ func main() {
|
||||
go refreshTrustNetwork(relay, ctx)
|
||||
|
||||
mux := relay.Router()
|
||||
static := http.FileServer(http.Dir(config.StaticPath))
|
||||
|
||||
mux.Handle("GET /static/", http.StripPrefix("/static/", static))
|
||||
mux.Handle("GET /favicon.ico", http.StripPrefix("/", static))
|
||||
|
||||
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
tmpl := template.Must(template.ParseFiles(os.Getenv("INDEX_PATH")))
|
||||
data := struct {
|
||||
@ -131,8 +136,6 @@ func main() {
|
||||
}
|
||||
})
|
||||
|
||||
mux.Handle("/favicon.ico", http.StripPrefix("/", http.FileServer(http.Dir(config.StaticPath))))
|
||||
|
||||
log.Println("🎉 relay running on port :3334")
|
||||
err := http.ListenAndServe(":3334", relay)
|
||||
if err != nil {
|
||||
|
Loading…
x
Reference in New Issue
Block a user