Open fardok opened 6 years ago
The server could implement a handler as below
func update(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, filepath.Join("path", "to", "myprogram.exe"))
}
...
http.HandleFunc("/update", update)
Given the doUpdate
func as per the README.md, the client might then update itself like this
if *updateFlag {
err := doUpdate("http://localhost/update")
if err != nil {
fmt.Println(err)
os.Exit(1)
}
os.Exit(0)
}
can somebody write any example handler for update?
func updateHandler(w http.ResponseWriter, r *http.Request){
file, err := os.Open("myprogram.exe")
etc....
}