mirror of
https://github.com/github/codeql.git
synced 2026-08-02 08:23:01 +02:00
26 lines
499 B
Go
26 lines
499 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"log"
|
|
"net/http"
|
|
|
|
"github.com/julienschmidt/httprouter"
|
|
)
|
|
|
|
func Index(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
|
|
fmt.Fprint(w, "Welcome!\n")
|
|
}
|
|
|
|
func Hello(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
|
|
fmt.Fprintf(w, "hello, %s!\n", ps.ByName("name"))
|
|
}
|
|
|
|
func badHTTPRouter() {
|
|
router := httprouter.New()
|
|
router.GET("/test/*test", Index)
|
|
router.GET("/hello/:name", Hello)
|
|
|
|
log.Fatal(http.ListenAndServe(":8082", router))
|
|
}
|