2023-12-19 20:13:32 -08:00
|
|
|
package main
|
2023-12-17 21:21:29 -08:00
|
|
|
|
2023-12-19 20:13:32 -08:00
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"log"
|
2023-12-19 20:51:52 -08:00
|
|
|
"net/http"
|
|
|
|
|
|
|
|
//"github.com/jmoiron/sqlx"
|
2023-12-19 20:13:32 -08:00
|
|
|
)
|
2023-12-17 21:21:29 -08:00
|
|
|
|
2023-12-19 20:51:52 -08:00
|
|
|
func hello(w http.ResponseWriter, req *http.Request) {
|
|
|
|
fmt.Fprintf(w, "hello\n")
|
|
|
|
}
|
|
|
|
|
|
|
|
func headers(w http.ResponseWriter, req *http.Request) {
|
|
|
|
for name, headers := range req.Header {
|
|
|
|
for _, h := range headers {
|
|
|
|
fmt.Fprintf(w, "%v: %v\n", name, h)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-12-17 21:21:29 -08:00
|
|
|
func main() {
|
2023-12-19 20:13:32 -08:00
|
|
|
log.SetPrefix("RecountServer: ")
|
|
|
|
log.SetFlags(0)
|
|
|
|
|
2023-12-19 20:51:52 -08:00
|
|
|
http.HandleFunc("/hello", hello)
|
|
|
|
http.HandleFunc("/headers", headers)
|
|
|
|
|
|
|
|
http.ListenAndServe(":8090", nil)
|
|
|
|
|
|
|
|
//fmt.Println("Hello World")
|
2023-12-17 21:21:29 -08:00
|
|
|
}
|