Skip to content

Instantly share code, notes, and snippets.

@jameshwc
Created April 5, 2021 06:07
Show Gist options
  • Save jameshwc/f3c7bfcd53351eeb9002ad574b2ca8c0 to your computer and use it in GitHub Desktop.
Save jameshwc/f3c7bfcd53351eeb9002ad574b2ca8c0 to your computer and use it in GitHub Desktop.
nasa midterm
package main
import (
"fmt"
"log"
"net/http"
)
func main() {
m := http.NewServeMux()
m.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("hello world"))
})
s := http.Server{Addr: ":80", Handler: m}
fmt.Println("Server is starting...")
if err := s.ListenAndServe(); err != nil {
log.Fatal(err)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment