No Description

main.go 421B

1234567891011121314151617181920212223242526
  1. package main
  2. import (
  3. "fmt"
  4. "html"
  5. "log"
  6. "net/http"
  7. "strconv"
  8. router "./core/router"
  9. )
  10. func main() {
  11. http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
  12. router.Add(`\/(.*)`, func(w http.ResponseWriter, r *http.Request) {
  13. fmt.Fprintf(w, "Hello Route, %q", html.EscapeString(r.URL.Path))
  14. })
  15. router.Match(w, r)
  16. })
  17. log.Fatal(http.ListenAndServe(":"+strconv.Itoa(SERVER_PORT), nil))
  18. }