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}