29 lines
570 B
Go
29 lines
570 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) {
|
|
vm := VideoInfoVM{
|
|
Title: "Foo",
|
|
Description: "Lorem Ipsum sed dolor...",
|
|
}
|
|
err := renderTemplate(w, "index", vm)
|
|
if err != nil {
|
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
}
|
|
})
|
|
|
|
err := http.ListenAndServe(addr, nil)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
}
|