Skip to content

Instantly share code, notes, and snippets.

@vaguecoder
Last active December 16, 2021 17:44
Show Gist options
  • Save vaguecoder/534560cddd711ae2c535809a00dd76ad to your computer and use it in GitHub Desktop.
Save vaguecoder/534560cddd711ae2c535809a00dd76ad to your computer and use it in GitHub Desktop.
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
jsonData, err = json.Marshal(data)
if err != nil {
// Handle Error
}
_, err = w.Write(jsonData)
if err != nil {
// Handle Error
}
})
err = http.ListenAndServe(":8080", nil)
if err != nil {
// Handle Error
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment