Created
December 27, 2019 21:24
-
-
Save rgorsuch/f50c98ef5d758c6399869ca6807b346f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"log" | |
"net/http" | |
) | |
const response = `{ | |
"queryID": 42, | |
"items": [ | |
{ | |
"itemID": "fd7d35de27f34fdab4af02b371cfc596", | |
"type": "element" | |
} | |
] | |
}` | |
func main() { | |
port := ":8080" | |
pattern := "/" | |
http.HandleFunc(pattern, func(writer http.ResponseWriter, request *http.Request) { | |
writer.Write([]byte(response)) | |
}) | |
fmt.Printf("Now serving http://localhost%v%v\n", port, pattern) | |
log.Fatal(http.ListenAndServe(port, nil)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment