Compare commits
2 commits
7f99677331
...
00361743d5
Author | SHA1 | Date | |
---|---|---|---|
00361743d5 | |||
3a2743cada |
3 changed files with 36 additions and 3 deletions
2
go.mod
2
go.mod
|
@ -1,3 +1,5 @@
|
||||||
module nickiel.net/recount_server
|
module nickiel.net/recount_server
|
||||||
|
|
||||||
go 1.21.5
|
go 1.21.5
|
||||||
|
|
||||||
|
require github.com/jmoiron/sqlx v1.3.5 // indirect
|
||||||
|
|
5
go.sum
Normal file
5
go.sum
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
|
||||||
|
github.com/jmoiron/sqlx v1.3.5 h1:vFFPA71p1o5gAeqtEAwLU4dnX2napprKtHr7PYIcN3g=
|
||||||
|
github.com/jmoiron/sqlx v1.3.5/go.mod h1:nRVWtLre0KfCLJvgxzCsLVMogSvQ1zNJtpYr2Ccp0mQ=
|
||||||
|
github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
||||||
|
github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
|
|
@ -1,7 +1,33 @@
|
||||||
package recount_server
|
package main
|
||||||
|
|
||||||
import "fmt"
|
import (
|
||||||
|
"fmt"
|
||||||
|
"log"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
//"github.com/jmoiron/sqlx"
|
||||||
|
)
|
||||||
|
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
fmt.Println("Hello World")
|
log.SetPrefix("RecountServer: ")
|
||||||
|
log.SetFlags(0)
|
||||||
|
|
||||||
|
http.HandleFunc("/hello", hello)
|
||||||
|
http.HandleFunc("/headers", headers)
|
||||||
|
|
||||||
|
http.ListenAndServe(":8090", nil)
|
||||||
|
|
||||||
|
//fmt.Println("Hello World")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue