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 + + + + +
-

Don't Laugh Challenge

-
// Joke goes here
- +

Hello from Go Server

+

The current time is:

- - + + + + diff --git a/firstApp/static/style.css b/firstApp/static/style.css index 481d42c..b0fd9a2 100644 --- a/firstApp/static/style.css +++ b/firstApp/static/style.css @@ -1,62 +1,36 @@ -@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap'); - -* { - box-sizing: border-box; -} - body { - background-color: #686de0; - font-family: 'Roboto', sans-serif; - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - height: 100vh; - overflow: hidden; - margin: 0; - padding: 20px; + font-family: Arial, sans-serif; + background-color: #f4f4f9; + margin: 0; + padding: 0; + display: flex; + justify-content: center; + align-items: center; + height: 100vh; + color: #333; } .container { - background-color: #fff; - border-radius: 10px; - box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1), 0 6px 6px rgba(0, 0, 0, 0.1); - padding: 50px 20px; - text-align: center; - max-width: 100%; - width: 800px; + text-align: center; + background-color: white; + padding: 30px; + border-radius: 10px; + box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.1); } -h3 { - margin: 0; - opacity: 0.5; - letter-spacing: 2px; +h1 { + font-size: 2.5rem; + color: #4CAF50; + margin-bottom: 10px; } -.joke { - font-size: 30px; - letter-spacing: 1px; - line-height: 40px; - margin: 50px auto; - max-width: 600px; +p { + font-size: 1.2rem; + color: #555; } -.btn { - background-color: #9f68e0; - color: #fff; - border: 0; - border-radius: 10px; - box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1), 0 6px 6px rgba(0, 0, 0, 0.1); - padding: 14px 40px; - font-size: 16px; - cursor: pointer; -} - -.btn:active { - transform: scale(0.98); -} - -.btn:focus { - outline: 0; +#time { + font-weight: bold; + color: #FF5722; }