Skip to content

Instantly share code, notes, and snippets.

@noateden
Created August 20, 2019 14:05
Show Gist options
  • Save noateden/d4c5e0d0fcc5e985ac0666390dee9ab2 to your computer and use it in GitHub Desktop.
Save noateden/d4c5e0d0fcc5e985ac0666390dee9ab2 to your computer and use it in GitHub Desktop.
package main
import (
"net/http"
)
func main() {
http.HandleFunc("/api", api.ApiRoot)
http.Handle("/", http.FileServer(http.Dir("public")))
http.ListenAndServe(":8080", nil)
}
func ApiRoot(rw http.ResponseWriter, r *http.Request) {
_, _ = rw.Write([]byte("Hello World!"))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment