This commit is contained in:
2023-10-20 12:37:56 +01:00
parent b5ba0d295a
commit bc801648a3
6 changed files with 182 additions and 131 deletions

23
main.go
View File

@@ -31,25 +31,24 @@ func main() {
defer db.Close()
fmt.Println("Starting server on :8000!")
//TODO check if file structure exists to save data
//TODO check if file structure exists to save data
handle := NewHandler(db)
_, err = db.Exec("update models set status=$1 where status=$2", models_utils.FAILED_TRAINING, models_utils.TRAINING);
if err != nil {
panic(err)
}
_, err = db.Exec("update models set status=$1 where status=$2", models_utils.FAILED_TRAINING, models_utils.TRAINING)
if err != nil {
panic(err)
}
// TODO Handle this in other way
handle.StaticFiles("/styles/", ".css", "text/css");
handle.StaticFiles("/js/", ".js", "text/javascript");
handle.ReadFiles("/imgs/", "views", ".png", "image/png;");
handle.ReadFiles("/savedData/", ".", ".png", "image/png;");
handle.StaticFiles("/styles/", ".css", "text/css")
handle.StaticFiles("/js/", ".js", "text/javascript")
handle.ReadFiles("/imgs/", "views", ".png", "image/png;")
handle.ReadTypesFiles("/savedData/", ".", []string{".png", ".jpeg"}, []string{"image/png", "image/jpeg"})
handle.GetHTML("/", AnswerTemplate("index.html", nil, 0))
usersEndpints(db, handle)
HandleModels(handle)
usersEndpints(db, handle)
HandleModels(handle)
handle.Startup()
}