Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fengsp/knight
One HTTP development server with reloader for Go
https://github.com/fengsp/knight
Last synced: about 2 months ago
JSON representation
One HTTP development server with reloader for Go
- Host: GitHub
- URL: https://github.com/fengsp/knight
- Owner: fengsp
- License: other
- Created: 2014-04-11T09:25:36.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2017-04-18T05:26:20.000Z (over 7 years ago)
- Last Synced: 2024-06-18T23:27:56.594Z (6 months ago)
- Language: Go
- Homepage:
- Size: 192 KB
- Stars: 69
- Watchers: 3
- Forks: 6
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
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.```Go
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