-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
30 lines (24 loc) · 806 Bytes
/
server.js
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
const express = require('express');
const path = require('path');
const app = express();
const port = 8080;
// Middleware para servir archivos estáticos desde la carpeta raíz
app.use(express.static(path.join(__dirname)));
// Ruta para el archivo index.html (página principal)
app.get('/', (req, res) => {
res.sendFile(path.join(__dirname, 'index.html'));
});
// Rutas para las páginas secundarias
app.get('/about', (req, res) => {
res.sendFile(path.join(__dirname, 'about.html'));
});
app.get('/artists', (req, res) => {
res.sendFile(path.join(__dirname, 'artists.html'));
});
app.get('/contact', (req, res) => {
res.sendFile(path.join(__dirname, 'contact.html'));
});
// Iniciar servidor
app.listen(port, () => {
console.log(`Server running at http://localhost:${port}`);
});