31 lines
574 B
Go
31 lines
574 B
Go
package main
|
|
|
|
import (
|
|
"net/http"
|
|
)
|
|
|
|
func readinessHandler(w http.ResponseWriter, r *http.Request) {
|
|
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
|
|
w.WriteHeader(http.StatusOK)
|
|
w.Write([]byte("OK"))
|
|
}
|
|
|
|
func main() {
|
|
mux := http.NewServeMux()
|
|
|
|
mux.HandleFunc("/healthz", readinessHandler)
|
|
|
|
fileServer := http.FileServer(http.Dir("./public"))
|
|
mux.Handle("/app/", http.StripPrefix("/app", fileServer))
|
|
|
|
server := &http.Server{
|
|
Addr: ":8080",
|
|
Handler: mux,
|
|
}
|
|
|
|
// Start the server
|
|
if err := server.ListenAndServe(); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|