added static load files,
added TPsoft logo to header, added build batch script for windows
This commit is contained in:
@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user