25 lines
465 B
Go
25 lines
465 B
Go
package main
|
|
|
|
import (
|
|
"log"
|
|
"net/http"
|
|
)
|
|
|
|
func serveWebview() {
|
|
addr := "localhost:8081"
|
|
|
|
log.Printf("Listening on %s", addr)
|
|
http.Handle("/static/", http.StripPrefix("/static/", staticFileServer()))
|
|
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
|
err := renderTemplate(w)
|
|
if err != nil {
|
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
}
|
|
})
|
|
|
|
err := http.ListenAndServe(addr, nil)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
}
|