@@ -12,7 +12,7 @@ async function startServer()
|
||||
await createTables();
|
||||
|
||||
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, () =>
|
||||
{
|
||||
|
||||
@@ -14,6 +14,7 @@ router.post('/register', async(req, res) =>
|
||||
|
||||
router.post('/login', async(req, res) =>
|
||||
{
|
||||
console.log("received login!");
|
||||
const {username, password} = req.body;
|
||||
const result = await authService.login(username, password);
|
||||
res.status(result.status).json(result.data);
|
||||
|
||||
@@ -87,14 +87,14 @@ export class LoginWindow extends fenetre {
|
||||
}
|
||||
|
||||
async connexion() {
|
||||
const response = await fetch("/api/login", {
|
||||
const response = await fetch("/api/auth/login", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
username: "nom",
|
||||
password: "a"
|
||||
username: this.username.value,
|
||||
password: this.password.value
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user