diff --git a/firstApp/Greeting.go b/firstApp/Greeting.go
index 91b943b..c69dd16 100644
--- a/firstApp/Greeting.go
+++ b/firstApp/Greeting.go
@@ -9,7 +9,6 @@ import (
// Serve the index.html file
func serveHTML(w http.ResponseWriter, r *http.Request) {
- // Open the file
file, err := os.Open("index.html")
if err != nil {
http.Error(w, "File not found", http.StatusNotFound)
@@ -17,7 +16,6 @@ func serveHTML(w http.ResponseWriter, r *http.Request) {
}
defer file.Close()
- // Set the content type as HTML and send the file contents
w.Header().Set("Content-Type", "text/html")
http.ServeContent(w, r, "index.html", time.Now(), file)
}
@@ -28,12 +26,12 @@ func serveTime(w http.ResponseWriter, r *http.Request) {
}
func main() {
- // Serve the HTML file on the root URL
+ // Serve the static CSS file from the "static" directory
http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("./static"))))
- // Serve the current time on the /time endpoint
+ http.HandleFunc("/", serveHTML)
http.HandleFunc("/time", serveTime)
- // Start the server on port 8085
+ fmt.Println("Starting server on :8085")
http.ListenAndServe(":8085", nil)
}
diff --git a/firstApp/index.html b/firstApp/index.html
index 22d1146..d03e5b8 100644
--- a/firstApp/index.html
+++ b/firstApp/index.html
@@ -1,17 +1,28 @@
-
-
-
-
- Dad Jokes
-
-
+
+
+
+
+ Go Server Hello
+
+
+
+
+