diff --git a/serwer.go b/serwer.go new file mode 100644 index 0000000..f2a0cd6 --- /dev/null +++ b/serwer.go @@ -0,0 +1,11 @@ +func main() { +db := database{"buty": 50, "skarpety": 5} +log.Fatal(http.ListenAndServe("localhost:8000", db)) +} +type dollars float32 +func (d dollars) String() string { return fmt.Sprintf("%.2f PLN", d) } +type database map[string]dollars +func (db database) ServeHTTP(w http.ResponseWriter, req *http.Request) { +for item, price := range db { +fmt.Fprintf(w, "%s: %s\n", item, price) +}