From c7d5863792b3d4eb98ef7c5a4a3d3b1ab93f1ad6 Mon Sep 17 00:00:00 2001
From: Yanick Champoux
Date: Sun, 4 Feb 2024 13:31:57 -0500
Subject: [PATCH 1/4] wip
---
contrib/nginx-bggsell.conf | 3 +
src/routes/+page.js | 5 +
src/routes/+page.server.js | 12 --
src/routes/+page.svelte | 4 +-
static/games.json | 234 +++++++++++++++++++++++++++++++++++++
5 files changed, 245 insertions(+), 13 deletions(-)
create mode 100644 src/routes/+page.js
delete mode 100644 src/routes/+page.server.js
create mode 100644 static/games.json
diff --git a/contrib/nginx-bggsell.conf b/contrib/nginx-bggsell.conf
index eabd1fe..fc7b2b1 100644
--- a/contrib/nginx-bggsell.conf
+++ b/contrib/nginx-bggsell.conf
@@ -17,4 +17,7 @@ server {
location / {
try_files $uri $uri/ $uri.html /index.html =404;
}
+ location /db/ {
+ alias /home/bggsell/db/;
+ }
}
diff --git a/src/routes/+page.js b/src/routes/+page.js
new file mode 100644
index 0000000..e2a6ff6
--- /dev/null
+++ b/src/routes/+page.js
@@ -0,0 +1,5 @@
+export async function load({ fetch }) {
+ return {
+ games: fetch('/games.json').then((doc) => doc.json()),
+ };
+}
diff --git a/src/routes/+page.server.js b/src/routes/+page.server.js
deleted file mode 100644
index 04e3583..0000000
--- a/src/routes/+page.server.js
+++ /dev/null
@@ -1,12 +0,0 @@
-import DB from 'better-sqlite3';
-
-const db_file = process.env.DATABASE_URL.replace('sqlite3:','');
-
-export async function load() {
- const db = DB(db_file);
- db.pragma('journal_mode = WAL');
-
- return {
- games: db.prepare( 'SELECT * from game').all()
- };
-}
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte
index 0a94655..59caf8f 100644
--- a/src/routes/+page.svelte
+++ b/src/routes/+page.svelte
@@ -28,7 +28,9 @@
>.
-
+ {#await data.games then games}
+
+ {/await}