mirror of
https://github.com/github/codeql.git
synced 2026-07-23 12:12:05 +02:00
26 lines
510 B
Go
26 lines
510 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) // $ Alert
|
|
router.GET("/hello/:name", Hello)
|
|
|
|
log.Fatal(http.ListenAndServe(":8082", router))
|
|
}
|