From 16240b8c012bc4cc4c31ce565eb5566a0de4e466 Mon Sep 17 00:00:00 2001 From: Jason Streifling Date: Wed, 4 Oct 2023 17:29:22 +0200 Subject: [PATCH] Simplen ServeMux erstellt --- main.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 38dd16d..fbbd276 100644 --- a/main.go +++ b/main.go @@ -1,3 +1,16 @@ package main -func main() {} +import ( + "html/template" + "log" + "net/http" +) + +func main() { + mux := http.NewServeMux() + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + template.Must(template.ParseFiles("templates/index.html")).Execute(w, nil) + }) + + log.Fatalln(http.ListenAndServe(":8080", mux)) +}