Skip to content

Commit

Permalink
feat(cmd/example_server): Add /dela html page
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejsika committed Feb 15, 2024
1 parent c04d991 commit a0e7357
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions cmd/example_server/example_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,20 @@ var Cmd = &cobra.Command{
fmt.Fprintf(w, "[slu "+version.Version+"] Example HTTP Server (after 15m)! %s %s \n", hostname, portStr)
})

http.HandleFunc("/dela", func(w http.ResponseWriter, r *http.Request) {
requestsTotal.Inc()
fmt.Fprint(w, `<!doctype html><html lang="en"><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Dela</title><style>
body, html { margin: 0; padding: 0; height: 100%; width: 100%; }
.dog-image-container { position: relative; height: 100%; width: 100%; overflow: hidden; }
.dog-image { object-fit: cover; width: 100%; height: 100%; display: block; }
</style></head><body>
<div class="dog-image-container"><img src="/dela.jpg" alt="Dela" class="dog-image" /></div>
</body></html>
`)
})

http.HandleFunc("/dela.jpg", func(w http.ResponseWriter, r *http.Request) {
requestsTotal.Inc()
w.Header().Set("Content-Type", "image/jpeg")
Expand Down

0 comments on commit a0e7357

Please sign in to comment.