mirror of
https://github.com/bitvora/wot-relay.git
synced 2025-06-06 18:31:05 +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)
|
go refreshTrustNetwork(relay, ctx)
|
||||||
|
|
||||||
mux := relay.Router()
|
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) {
|
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||||
tmpl := template.Must(template.ParseFiles(os.Getenv("INDEX_PATH")))
|
tmpl := template.Must(template.ParseFiles(os.Getenv("INDEX_PATH")))
|
||||||
data := struct {
|
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")
|
log.Println("🎉 relay running on port :3334")
|
||||||
err := http.ListenAndServe(":3334", relay)
|
err := http.ListenAndServe(":3334", relay)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user