12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- package main
- import (
- "fmt"
- "net/http"
- )
- func Index(w http.ResponseWriter, r *http.Request) {
- fmt.Println("Recv data")
-
- }
- func Update(w http.ResponseWriter, r *http.Request) {
- fmt.Println(r.URL.Path)
- fmt.Println(r.Method)
- fmt.Println(r.Header)
- if r.URL.Path == "/fw.bin" {
- fmt.Println("Download update file...")
- http.ServeFile(w, r, `fw.bin`)
- }
- }
- func main() {
- fmt.Println("Starting HTTP server...")
- http.HandleFunc("/index.html", Index)
- http.HandleFunc("/fw.bin", Update)
- http.ListenAndServe(":9000", nil)
- }
|