18 lines
306 B
Go
18 lines
306 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"net/http"
|
||
|
|
||
|
"kumoly.io/lib/guard"
|
||
|
)
|
||
|
|
||
|
func main() {
|
||
|
mux := http.NewServeMux()
|
||
|
g := guard.New()
|
||
|
g.SetBasicAuth("evan", "evan")
|
||
|
mux.HandleFunc("/", func(rw http.ResponseWriter, r *http.Request) {
|
||
|
rw.Write([]byte("ok"))
|
||
|
})
|
||
|
http.ListenAndServe("127.0.0.1:8000", g.Guard(mux))
|
||
|
}
|