DB connection restored.
This commit is contained in:
Binary file not shown.
@@ -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 =
|
||||
|
||||
35
server/src/scripts/test-db.ts
Normal file
35
server/src/scripts/test-db.ts
Normal file
@@ -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();
|
||||
Reference in New Issue
Block a user