-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
46 lines (35 loc) · 1.2 KB
/
index.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
const express = require('express');
const app = express();
const path = require('path');
let port = 4000;
app.use(express.json());
app.use(express.static(path.join(__dirname, 'public')));
// -------------- ROUTES --------------
const menuRouter = require('./routes/menu.js');
app.use('/menu', menuRouter);
const usuarioRouter = require('./routes/usuarios.js');
app.use('/usuarios', usuarioRouter);
// ------------------------------------
//PRINCIPAL
app.get("/home",(req,res) => {
res.sendFile(path.join(__dirname,'public','index.html'));
});
app.get("/contacto",(req,res) => {
res.sendFile(path.join(__dirname,'public','form-contacto.html'));
});
app.get("/menu",(req,res) => {
res.sendFile(path.join(__dirname,'public','menu.html'));
});
app.get("/nosotros",(req,res) => {
res.sendFile(path.join(__dirname,'public','nosotros.html'));
});
app.get("/usuarios",(req,res) => {
res.sendFile(path.join(__dirname,'public','usuarios.html'));
});
app.listen(port, () => {
console.log(`Servidor express ejecutandose en el puerto ${port}`);
});
// MULTER
app.use('/uploads', express.static(path.join(__dirname, 'uploads')));
//
//nodemon: node --watch index.js PARA QUE SE ACTUALICE EL ARCHIVO.