We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 18725dd commit 45c8e66Copy full SHA for 45c8e66
server.go
@@ -68,7 +68,11 @@ func handleComments(w http.ResponseWriter, r *http.Request) {
68
return
69
}
70
71
+ w.Header().Set("Content-Type", "application/json")
72
+ io.Copy(w, bytes.NewReader(commentData))
73
+
74
case "GET":
75
76
// stream the contents of the file to the response
77
io.Copy(w, bytes.NewReader(commentData))
78
@@ -81,5 +85,6 @@ func handleComments(w http.ResponseWriter, r *http.Request) {
81
85
func main() {
82
86
http.HandleFunc("/comments.json", handleComments)
83
87
http.Handle("/", http.FileServer(http.Dir("./public")))
88
+ log.Println("Server started: http://localhost:3000")
84
89
log.Fatal(http.ListenAndServe(":3000", nil))
90
0 commit comments