package main
import (
"fmt"
"net/http"
"github.com/k4s/httprouter"
)
func Whoami(w http.ResponseWriter, r *http.Request) {
params := r.URL.Query()
firstName := params.Get(":first")
lastName := params.Get(":last")
fmt.Fprintf(w, "you are %s ,%s", firstName, lastName)
}
func Who(w http.ResponseWriter, r *http.Request) {
params := r.URL.Query()
Name := params.Get(":id")
fmt.Fprintf(w, "Iam %s", Name)
}
func main() {
mux := httprouter.New()
mux.Get("/:first(kas)/:last", Whoami)
mux.Put("/user(user)/:id([0-9]+)", Who)
// http.Handle("/", mux)
http.ListenAndServe(":8088", mux)
}
-
Notifications
You must be signed in to change notification settings - Fork 0
k4s/httprouter
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
a simple httprouter for go
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published