*.go: add a golang webserver for this project
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
parent
025604ce28
commit
58ebeb91d8
2 changed files with 29 additions and 0 deletions
9
content.go
Normal file
9
content.go
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"embed"
|
||||||
|
)
|
||||||
|
|
||||||
|
//go:embed "htmx.min.js"
|
||||||
|
//go:embed "index.html"
|
||||||
|
var content embed.FS
|
20
main.go
Normal file
20
main.go
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"log"
|
||||||
|
"net/http"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
|
||||||
|
s := &http.Server{
|
||||||
|
Addr: ":8080",
|
||||||
|
//Handler: myHandler,
|
||||||
|
ReadTimeout: 10 * time.Second,
|
||||||
|
WriteTimeout: 10 * time.Second,
|
||||||
|
MaxHeaderBytes: 1 << 20,
|
||||||
|
}
|
||||||
|
http.Handle("/", http.FileServer(http.FS(content)))
|
||||||
|
log.Fatal(s.ListenAndServe())
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue