-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
31 lines (22 loc) · 890 Bytes
/
app.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
const path = require('path');
const express = require('express');
const bodyParser = require('body-parser');
//const expressHbs = require('express-handlebars'); CUANDO QUIERAR HANDLEBARS COMO TEMPLATE
const errorController = require('./controllers/error')
const app = express();
//installing express pug dinamic template
//app.engine('hbs', expressHbs({layoutsDir: 'views/layouts/', defaultLayout:'main-layout', extname:'hbs' }));
app.set('view engine' , 'ejs');
app.set('views', 'views');
//Routes Link
const adminRoutes = require('./routes/admin');
const shopRoutes = require('./routes/shop');
app.use(bodyParser.urlencoded({extended: true}));
//Acces to css forms
app.use(express.static(path.join(__dirname, 'public')));
//Acces to admin Routes
app.use('/admin', adminRoutes);
app.use(shopRoutes);
//Acess response to 404 ejs
app.use(errorController.get404);
app.listen(3000);