Skip to content

Instantly share code, notes, and snippets.

@rgorsuch
Created December 27, 2019 21:24
Show Gist options
  • Save rgorsuch/f50c98ef5d758c6399869ca6807b346f to your computer and use it in GitHub Desktop.
Save rgorsuch/f50c98ef5d758c6399869ca6807b346f to your computer and use it in GitHub Desktop.
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