https://github.com/koonix/go-livereload
Go library that adds live reloading capability to any http handler.
https://github.com/koonix/go-livereload
development-server go hot-reload hotreload live-reload livereload
Last synced: 4 months ago
JSON representation
Go library that adds live reloading capability to any http handler.
- Host: GitHub
- URL: https://github.com/koonix/go-livereload
- Owner: koonix
- License: apache-2.0
- Created: 2025-03-01T02:31:40.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-04-23T11:27:36.000Z (8 months ago)
- Last Synced: 2025-06-08T13:03:14.591Z (7 months ago)
- Topics: development-server, go, hot-reload, hotreload, live-reload, livereload
- Language: Go
- Homepage: https://pkg.go.dev/github.com/koonix/go-livereload
- Size: 42 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-livereload
go-livereload is a Go library
that adds live reloading capability
to any http handler.
## Usage
Import:
```go
package main
import "github.com/koonix/go-livereload"
```
Serve a directory:
```go
upstream := http.FileServer(http.Dir("frontend"))
lr := livereload.New(upstream)
http.ListenAndServe(":8090", lr)
```
Proxy another webserver:
```go
u, _ := url.Parse("http://localhost:8080")
upstream := livereload.ReverseProxy(u)
lr := livereload.New(upstream)
http.ListenAndServe(":8090", lr)
```
Reload the webpages open in browsers:
```go
lr.Reload()
```