1 const express = require('express'); // pide express sea requerido
2 const path = require('path'); // pide que path sea requerido
8 app.set('port', process.env.PORT || 3000);
9 app.set('views', path.join(__dirname, 'views'));
10 app.set('view engine', 'ejs');
13 app.use(express.urlencoded({
16 app.use(express.json());
17 //para que la ruta de estilos y js sea visible
18 app.use('/styles', express.static('styles'));
19 app.use('/js', express.static('js'));
20 app.use('/img', express.static('img'));
21 app.use('/node_modules', express.static('node_modules'));
23 app.use(require('./routes/index'));
24 // Configurar cabeceras y cors
26 app.listen(app.get('port'), () => {
27 console.log("Servidor escuchando en el puerto", app.get('port'))