Skip to content

koonix/go-livereload

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-livereload

go-livereload is a Go library that adds live reloading capability to any http handler.

Usage

Import:

package main

import "github.com/koonix/go-livereload"

Serve a directory:

upstream := http.FileServer(http.Dir("frontend"))
lr := livereload.New(upstream)
http.ListenAndServe(":8090", lr)

Proxy another webserver:

u, _ := url.Parse("http://localhost:8080")
upstream := livereload.ReverseProxy(u)
lr := livereload.New(upstream)
http.ListenAndServe(":8090", lr)

Reload the webpages open in browsers:

lr.Reload()

About

Go library that adds live reloading capability to any http handler.

Topics

Resources

License

Stars

Watchers

Forks

Languages