-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest_auth.js
More file actions
34 lines (31 loc) · 1.03 KB
/
test_auth.js
File metadata and controls
34 lines (31 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
async function test() {
const email = `test_${Date.now()}@example.com`;
const password = "password123";
console.log('--- Registering ---');
try {
const res = await fetch('https://cortexcrew-timecure-2.onrender.com/api/auth/register', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ username: "tester", email, password })
});
console.log('Register Status:', res.status);
const body = await res.text();
console.log('Register Body:', body);
} catch (err) {
console.error('Register error:', err);
}
console.log('\n--- Logging In ---');
try {
const res = await fetch('https://cortexcrew-timecure-2.onrender.com/api/auth/login', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ email, password })
});
console.log('Login Status:', res.status);
const body = await res.text();
console.log('Login Body:', body);
} catch (err) {
console.error('Login error:', err);
}
}
test();