-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathapp.js.bck
More file actions
32 lines (25 loc) · 911 Bytes
/
app.js.bck
File metadata and controls
32 lines (25 loc) · 911 Bytes
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
const express = require('express');
const path = require('path');
const app = express();
// Serve static files from the 'public' directory
app.use(express.static(path.join(__dirname, 'public')));
// Parse form data
app.use(express.urlencoded({ extended: true }));
// Route for serving the authentication page
app.get('/', (req, res) => {
res.sendFile(path.join(__dirname, 'public', 'index.html'));
});
// Route for handling authentication form submission
app.post('/dashboard', (req, res) => {
const { username, password } = req.body;
// Replace with your authentication logic
if (username === 'your_username' && password === 'your_password') {
res.sendFile(path.join(__dirname, 'public', 'dashboard.html'));
} else {
res.send('Authentication failed');
}
});
// Start the server
app.listen(3001, () => {
console.log('Badging App is running on port 3001');
});