Spaces:
Running
Running
Update app.js
Browse files
app.js
CHANGED
@@ -67,7 +67,6 @@ app.use(session({
|
|
67 |
}
|
68 |
}));
|
69 |
|
70 |
-
// Example login route
|
71 |
app.post('/api/login', async (req, res) => {
|
72 |
const { email, password } = req.body;
|
73 |
try {
|
@@ -90,7 +89,13 @@ app.post('/api/login', async (req, res) => {
|
|
90 |
res.status(200).send('Login successful');
|
91 |
} catch (error) {
|
92 |
logger.error('Login error:', error);
|
93 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
}
|
95 |
});
|
96 |
|
|
|
67 |
}
|
68 |
}));
|
69 |
|
|
|
70 |
app.post('/api/login', async (req, res) => {
|
71 |
const { email, password } = req.body;
|
72 |
try {
|
|
|
89 |
res.status(200).send('Login successful');
|
90 |
} catch (error) {
|
91 |
logger.error('Login error:', error);
|
92 |
+
|
93 |
+
// If the error is a string and not a JSON response, send as plain text
|
94 |
+
if (error.message && error.message.startsWith('Unexpected token')) {
|
95 |
+
res.status(500).send(error.message); // Handle unexpected response format
|
96 |
+
} else {
|
97 |
+
res.status(500).send('Internal server error');
|
98 |
+
}
|
99 |
}
|
100 |
});
|
101 |
|