init: 17 - simple page with go ssr
This commit is contained in:
parent
ee914c8014
commit
f30d9dad94
|
@ -0,0 +1,7 @@
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
let pname = "countries-page";
|
||||||
|
in {
|
||||||
|
# todo, building app
|
||||||
|
# building docker image
|
||||||
|
# nixos module
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
module sunshine.industries/results-summary-component-go
|
||||||
|
|
||||||
|
go 1.20
|
|
@ -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))
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
hello!
|
|
@ -45,7 +45,16 @@
|
||||||
pkgs.nodePackages.tailwindcss
|
pkgs.nodePackages.tailwindcss
|
||||||
pkgs.nodePackages.prettier
|
pkgs.nodePackages.prettier
|
||||||
pkgs.jdk
|
pkgs.jdk
|
||||||
|
|
||||||
|
pkgs.go
|
||||||
|
pkgs.wgo
|
||||||
|
pkgs.semgrep
|
||||||
|
pkgs.gopls
|
||||||
];
|
];
|
||||||
|
shellHook = ''
|
||||||
|
export GOPATH=$PWD/.go
|
||||||
|
export PATH=$GOPATH/bin:$PATH
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
packages.price-grid-app = price-grid.package;
|
packages.price-grid-app = price-grid.package;
|
||||||
nixosModules.price-grid-app = price-grid.module;
|
nixosModules.price-grid-app = price-grid.module;
|
||||||
|
|
Loading…
Reference in New Issue