Skip to content

Commit 0272276

Browse files
committed
Add supabase
1 parent c04cbe4 commit 0272276

File tree

10 files changed

+435
-63
lines changed

10 files changed

+435
-63
lines changed

$lib/client.ts

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { createClient } from '@supabase/supabase-js';
2+
import { Database } from '../types/database.types';
3+
4+
const client = createClient<Database>(process.env.API_URL!, process.env.ANON_KEY!, {
5+
auth: { persistSession: false }
6+
});
7+
8+
export const createPost = async (page: string, content: string) =>
9+
client.from('posts').insert({ page, content });
10+
11+
export const readPosts = async () => client.from('posts').select();

package.json

+11-7
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@
1010
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
1111
"test": "vitest",
1212
"lint": "prettier --plugin-search-dir . --check . && eslint .",
13-
"format": "prettier --plugin-search-dir . --write ."
13+
"format": "prettier --plugin-search-dir . --write .",
14+
"sb:start": "supabase start && supabase status -o env > .env.local",
15+
"sb:stop": "supabase stop",
16+
"sb:reset": "supabase db reset",
17+
"sb:migration:new": "supabase migration new",
18+
"sb:typegen": "supabase gen types typescript --local > 'types/database.types.ts'"
1419
},
1520
"devDependencies": {
1621
"@sveltejs/adapter-auto": "^2.0.0",
@@ -30,11 +35,10 @@
3035
"tslib": "^2.4.1",
3136
"typescript": "^5.0.0",
3237
"vite": "^4.3.6",
33-
"vitest": "^0.32.2"
34-
},
35-
"type": "module",
36-
"dependencies": {
38+
"vitest": "^0.32.2",
3739
"@supabase/supabase-js": "^2.26.0",
3840
"supabase": "^1.75.3"
39-
}
40-
}
41+
},
42+
"type": "module",
43+
"dependencies": {}
44+
}

0 commit comments

Comments
 (0)