init: 17 - simple page with go ssr

This commit is contained in:
efim
2023-10-03 10:15:07 +00:00
parent ee914c8014
commit f30d9dad94
7 changed files with 43 additions and 0 deletions

View File

View File

@@ -0,0 +1,7 @@
{ config, lib, pkgs, ... }:
let pname = "countries-page";
in {
# todo, building app
# building docker image
# nixos module
}

View File

@@ -0,0 +1,3 @@
module sunshine.industries/results-summary-component-go
go 1.20

View File

@@ -0,0 +1,23 @@
package main
import (
"embed"
"io"
"log"
"net/http"
)
//go:embed public
var publicContent embed.FS
// starts webserver that serves html page for exercise
func main() {
// visible on http://localhost:8080/static/public/some-text.txt
http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.FS(publicContent))))
http.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) {
io.WriteString(w, "This is temporary here, hello")
})
log.Print("starting server on default :8080")
log.Fatal(http.ListenAndServe(":8080", nil))
}

View File

@@ -0,0 +1 @@
hello!