This commit is contained in:
2024-12-20 01:15:56 +01:00
parent 39015d66ae
commit a711e5742d
3 changed files with 103 additions and 0 deletions

25
cmd/main.go Normal file
View File

@@ -0,0 +1,25 @@
package main
import (
"fmt"
"net/http"
)
func test(w http.ResponseWriter, req *http.Request) {
for name, headers := range req.Header {
for _, h := range headers {
fmt.Fprintf(w, "%v: %v\n", name, h)
}
}
}
func main() {
http.HandleFunc("/test", test)
// Serve files from the "static" directory
fs := http.FileServer(http.Dir("./static"))
http.Handle("/", http.StripPrefix("/", fs))
http.ListenAndServe(":8090", nil)
}

3
go.mod Normal file
View File

@@ -0,0 +1,3 @@
module frontend
go 1.23.3

75
static/index.html Normal file
View File

@@ -0,0 +1,75 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dark Mode Article Previews</title>
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
body {
background-color: #121212;
color: #ffffff;
}
.article-preview {
background-color: #1e1e1e;
border: 1px solid #2c2c2c;
}
a {
color: #0d6efd;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
p {
color: white
}
h5 {
color: white
}
</style>
</head>
<body>
<div class="container py-5">
<h1 class="text-center mb-auto">Article Previews</h1>
<div class="column">
<!-- Article 1 -->
<div class="col-md-6 mb-4">
<div class="card article-preview p-3">
<h5 class="card-title">Article Title 1</h5>
<p class="card-text">This is a short preview of the article content. It provides a quick summary to entice readers to click and read more.</p>
<a href="#" class="stretched-link">Read More</a>
</div>
</div>
<!-- Article 2 -->
<div class="col-md-6 mb-4">
<div class="card article-preview p-3">
<h5 class="card-title">Article Title 2</h5>
<p class="card-text">This is another preview of an article. It gives a brief overview to encourage users to explore further.</p>
<a href="#" class="stretched-link">Read More</a>
</div>
</div>
<!-- Article 3 -->
<div class="col-md-6 mb-4">
<div class="card article-preview p-3">
<h5 class="card-title">Article Title 3</h5>
<p class="card-text">A concise description of the article to pique interest and direct readers to the full content.</p>
<a href="#" class="stretched-link">Read More</a>
</div>
</div>
</div>
</div>
<!-- Bootstrap JS Bundle -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>