This commit is contained in:
2026-01-10 18:24:54 +01:00
parent ad37e26426
commit be7e3b88d5
3 changed files with 5 additions and 4 deletions
+1 -1
View File
@@ -12,7 +12,7 @@ async function startServer()
await createTables(); await createTables();
app.use('/api/auth', authRouter); app.use('/api/auth', authRouter);
app.get('/api/', (req, res) => res.send('Backend running')); app.get('/api', (req, res) => res.send('Backend running'));
app.listen(3001, () => app.listen(3001, () =>
{ {
+1
View File
@@ -14,6 +14,7 @@ router.post('/register', async(req, res) =>
router.post('/login', async(req, res) => router.post('/login', async(req, res) =>
{ {
console.log("received login!");
const {username, password} = req.body; const {username, password} = req.body;
const result = await authService.login(username, password); const result = await authService.login(username, password);
res.status(result.status).json(result.data); res.status(result.status).json(result.data);
+3 -3
View File
@@ -87,14 +87,14 @@ export class LoginWindow extends fenetre {
} }
async connexion() { async connexion() {
const response = await fetch("/api/login", { const response = await fetch("/api/auth/login", {
method: "POST", method: "POST",
headers: { headers: {
"Content-Type": "application/json" "Content-Type": "application/json"
}, },
body: JSON.stringify({ body: JSON.stringify({
username: "nom", username: this.username.value,
password: "a" password: this.password.value
}) })
}); });