diff --git a/server/prisma/dev.db b/server/prisma/dev.db index 48dc7ec..ff48569 100644 Binary files a/server/prisma/dev.db and b/server/prisma/dev.db differ diff --git a/server/src/lib/prisma.ts b/server/src/lib/prisma.ts index 83d56a0..646bfe5 100644 --- a/server/src/lib/prisma.ts +++ b/server/src/lib/prisma.ts @@ -39,6 +39,8 @@ if (!dbUrl) { } console.log('Initializing Prisma Adapter with URL:', dbUrl); + +// Use the options object as required by the library definitions const adapter = new PrismaBetterSqlite3({ url: dbUrl }); const prisma = diff --git a/server/src/scripts/test-db.ts b/server/src/scripts/test-db.ts new file mode 100644 index 0000000..bedef68 --- /dev/null +++ b/server/src/scripts/test-db.ts @@ -0,0 +1,35 @@ + +async function main() { + const email = `test_${Date.now()}@example.com`; + const password = 'password123'; + + console.log(`Registering ${email}...`); + try { + const regRes = await fetch('http://localhost:3001/api/auth/register', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ email, password }) + }); + const regData = await regRes.json(); + console.log('Register:', regRes.status, regData); + + if (!regData.success) { + console.error('Registration failed'); + return; + } + + console.log('Logging in...'); + const loginRes = await fetch('http://localhost:3001/api/auth/login', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ email, password }) + }); + const loginData = await loginRes.json(); + console.log('Login:', loginRes.status, loginData.success ? 'Success' : 'Fail'); + + } catch (e) { + console.error('Fetch failed:', e); + } +} + +main(); diff --git a/vite.config.ts b/vite.config.ts index dd8eba8..fd5f6dc 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -10,7 +10,7 @@ export default defineConfig(({ mode }) => { host: '0.0.0.0', proxy: { '/api': { - target: 'http://127.0.0.1:3002', + target: 'http://127.0.0.1:3001', changeOrigin: true, secure: false, }