Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 

knight

One HTTP web server with reloader for Go, knight detects file changes and restart the server automatically.

##install

$ go get github.com/fengsp/knight

##usage Basically you just need to set one watching path.

package main
    
import (
    "fmt"
    "net/http"
    "github.com/fengsp/knight"
)

func handler(w http.ResponseWriter, r *http.Request) {
    fmt.Fprintf(w, "It works!")
}

func main() {
    http.HandleFunc("/", handler)
    // pass your root path in
    // pass "" to use current working directory
    knight := knight.NewKnight("/private/tmp/test")
    knight.ListenAndServe(":8000", nil)
}

You can get it working like this:

$ go run test.go
 * Knight serving on :8000
 * Restarting with reloader
 * Detected change, reloading
 * Restarting with reloader
 * Detected change, reloading
 * Restarting with reloader

About

One HTTP development server with reloader for Go

Resources

License

Releases

No releases published

Packages

No packages published

Languages