forked from SpurgenO1/-Service-Management-System
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestAuth.js
More file actions
20 lines (19 loc) · 795 Bytes
/
Copy pathtestAuth.js
File metadata and controls
20 lines (19 loc) · 795 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
const testAuth = async () => {
try {
const resReg = await fetch('http://localhost:3000/api/auth/register', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ name: 'Bob', email: 'bob@bob.com', password: 'bobpass12' })
});
console.log('Register Res:', resReg.status, await resReg.text());
const resLog = await fetch('http://localhost:3000/api/auth/login', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ email: 'bob@bob.com', password: 'bobpass12' })
});
console.log('Login Res:', resLog.status, await resLog.text());
} catch(e) {
console.error(e);
}
};
testAuth();