Update Database

Database is more usable now.
All pages have been updated to use the database, and share an application configuration.
Page Stack has been removed, no more pages hanging around in memory. Replaced with a 'Router' which uses an Enum to determine which page should be displayed, destroys the old page and initializes the new page all in one go. No more push, pop, rollback, etc. No more holding instances of pages.
Logger has been updated with proper timestamps and sorting now works as expected."
This commit is contained in:
NeilClack
2026-03-23 15:02:07 -05:00
parent f8fbfb721d
commit 17c088cc2f
28 changed files with 537 additions and 2276 deletions
+26
View File
@@ -0,0 +1,26 @@
package netreq
import (
"fmt"
"io"
"net/http"
)
// Makes a GET request to the specified URL and returns the JSON response
// as a byte slice. If the request fails, it returns an error.
func GetJSON(url string) ([]byte, error) {
fmt.Println(url)
res, err := http.Get(url)
if err != nil {
return nil, err
}
body, err := io.ReadAll(res.Body)
res.Body.Close()
if res.StatusCode > 299 {
return nil, fmt.Errorf("request failed with status code %d: %s", res.StatusCode, string(body))
}
if err != nil {
return nil, err
}
return body, nil
}