kavea/src/main.go

44 lines
757 B
Go

package main
import (
"embed"
"log"
"net/http"
"runtime"
"github.com/zserge/lorca"
)
//go:embed templates
var templatesHTML embed.FS
//go:embed static
var staticFiles embed.FS
func main() {
log.SetFlags(log.Lshortfile)
Test()
/* Web Server */
http.Handle("/static/", http.FileServer(http.FS(staticFiles)))
http.HandleFunc("/", GetHome) // Redirects to /search if auth'd
/* Start Web Server */
go func() {
log.Println("Server is running!")
log.Fatal(http.ListenAndServe(":3000", nil))
}()
/* GUI */
args := []string{}
if runtime.GOOS == "linux" {
args = append(args, "--class=Lorca")
}
ui, err := lorca.New("http://localhost:3000", "", 1000, 800, args...)
if err != nil {
log.Fatal(err)
}
defer ui.Close()
<-ui.Done()
}