diff --git a/assets/logo.png b/assets/logo.png new file mode 100644 index 0000000..fe5c99f Binary files /dev/null and b/assets/logo.png differ diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..8365c87 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module github.com/finchrelia/chirpy-server + +go 1.22.5 diff --git a/index.html b/index.html new file mode 100644 index 0000000..16478fa --- /dev/null +++ b/index.html @@ -0,0 +1,7 @@ + + + +

Welcome to Chirpy

+ + + \ No newline at end of file diff --git a/main.go b/main.go new file mode 100644 index 0000000..1913d4b --- /dev/null +++ b/main.go @@ -0,0 +1,22 @@ +package main + +import ( + "net/http" +) + +func main() { + mux := http.NewServeMux() + fileServer := http.FileServer(http.Dir(".")) + mux.Handle("/app", http.StripPrefix("/app", fileServer)) + mux.Handle("/app/assets/", http.StripPrefix("/app/assets/", http.FileServer(http.Dir("./assets/")))) + mux.HandleFunc("/healthz", func(w http.ResponseWriter, req *http.Request) { + req.Header.Set("Content-Type", "text/plain; charset=utf-8") + w.WriteHeader(http.StatusOK) + w.Write([]byte("OK")) + }) + server := &http.Server{ + Addr: ":8080", + Handler: mux, + } + server.ListenAndServe() +}