added static load files,

added TPsoft logo to header,
added build batch script for windows
This commit is contained in:
2026-01-22 20:58:07 +01:00
parent 78aaf83d6e
commit b692a58ee2
4 changed files with 67 additions and 9 deletions

View File

@ -2,6 +2,7 @@ package main
import (
"database/sql"
"embed"
"encoding/json"
"fmt"
"io/ioutil"
@ -17,6 +18,9 @@ import (
_ "github.com/go-sql-driver/mysql"
)
//go:embed index.html static/*
var embeddedFiles embed.FS
// Config struct for database connection
type Config struct {
Username string `json:"username"`
@ -81,8 +85,11 @@ func main() {
os.Mkdir(historyDir, 0755)
}
// Serve static files
fs := http.FS(embeddedFiles)
// HTTP Handlers
http.HandleFunc("/", serveIndex)
http.Handle("/", http.FileServer(fs))
http.HandleFunc("/query", handleQuery)
http.HandleFunc("/history/", handleHistory)