go-web/main.go
2024-09-05 17:30:59 +02:00

28 lines
436 B
Go

package main
import (
"fmt"
"html"
"log"
"net/http"
"git.vinchent.xyz/vinchent/go-web/framework"
)
type FooHandler struct{}
func (foo FooHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello, %q", html.EscapeString(r.URL.Path))
}
func main() {
server := &http.Server{
Addr: ":8080",
Handler: framework.NewCore(),
}
if err := server.ListenAndServe(); err != nil {
log.Panic(err)
}
}