all repos — homestead @ 5a81e51a0cea5ecc4a0d117157393825ce5445fa

Code for my website

fix livereload handler error

Alan Pearce
commit

5a81e51a0cea5ecc4a0d117157393825ce5445fa

parent

339da20e693b3448a9f71c85555e1831af57c0df

1 file changed, 9 insertions(+), 2 deletions(-)

changed files
M internal/server/server.gointernal/server/server.go
@@ -6,6 +6,7 @@ "fmt"
"net/http" "time" + "github.com/osdevisnot/sorvor/pkg/livereload" "go.alanpearce.eu/x/log" "gitlab.com/tozd/go/errors"
@@ -26,8 +27,9 @@ type Options struct {
ListenAddress string `conf:"default:localhost"` Port int `conf:"default:8080,short:p"` - Domains []string `conf:"-"` - WildcardDomains []string `conf:"-"` + LiveReload *livereload.LiveReload `conf:"-"` + Domains []string `conf:"-"` + WildcardDomains []string `conf:"-"` } type Server struct {
@@ -81,6 +83,11 @@ serverHeaderHandler(
wrapHandlerWithLogging(s.mux, s.log), ), ) + + if s.options.LiveReload != nil { + top.Handle("/_/reload", s.options.LiveReload) + s.options.LiveReload.Start() + } top.HandleFunc("/health", func(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(http.StatusNoContent)