Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fgm/7cbdba065730b3bbfdf9 to your computer and use it in GitHub Desktop.
Save fgm/7cbdba065730b3bbfdf9 to your computer and use it in GitHub Desktop.
package main
import (
"net/http"
"fmt"
)
func main() {
mux := http.NewServeMux()
mux.HandleFunc("/articles/", func (w http.ResponseWriter, r *http.Request) {
fmt.Fprintln(w, "Hello from /articles/")
})
mux.HandleFunc("/articles/latest/", func (w http.ResponseWriter, r *http.Request) {
fmt.Fprintln(w, "Hello from /articles/latest")
})
mux.HandleFunc("/users", func (w http.ResponseWriter, r *http.Request) {
fmt.Fprintln(w, "Hello from /users")
})
http.ListenAndServe(":8000", mux)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment