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);
|
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 adapter = new PrismaBetterSqlite3({ url: dbUrl });
|
||||||
|
|
||||||
const prisma =
|
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();
|
||||||
@@ -10,7 +10,7 @@ export default defineConfig(({ mode }) => {
|
|||||||
host: '0.0.0.0',
|
host: '0.0.0.0',
|
||||||
proxy: {
|
proxy: {
|
||||||
'/api': {
|
'/api': {
|
||||||
target: 'http://127.0.0.1:3002',
|
target: 'http://127.0.0.1:3001',
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
secure: false,
|
secure: false,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user