19 lines
430 B
Go
19 lines
430 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"log"
|
|
"net/http"
|
|
)
|
|
|
|
func main() {
|
|
mux := http.NewServeMux()
|
|
mux.HandleFunc("/api/posts/", func(w http.ResponseWriter, r *http.Request) {
|
|
fmt.Fprintf(w, "GOT posts/ handler: path=%s\n", r.URL.Path)
|
|
})
|
|
mux.HandleFunc("/api/posts", func(w http.ResponseWriter, r *http.Request) {
|
|
fmt.Fprintf(w, "GOT posts handler: path=%s\n", r.URL.Path)
|
|
})
|
|
log.Fatal(http.ListenAndServe(":8700", mux))
|
|
}
|