-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
57 lines (44 loc) · 1.11 KB
/
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
const express = require ('express');
const app = express();
const path = require('path');
const data = require('./utils/data');
const title = 'Origen';
const port = process.env.PORT || 3000;
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'ejs');
app.use(express.static(path.join(__dirname, 'public')));
app.get('/', (req, res)=>{
data.getAllDishes((error, data)=>{
if(error){
return res.send({
error
})
}
const JSONBody = JSON.parse(data);
return res.render('index', {
title,
JSONBody
});
})
})
app.get('/comidas', (req, res)=>{
res.render('pages/comidas', {
title: `${title} | Comidas`,
//dishes
})
})
app.get('/infusiones', (req, res)=>{
res.render('pages/infusiones',{
title: `${title} | Infusiones`,
//dishes
})
})
app.get('/contacto', (req, res)=>{
res.render('pages/contacto', {
title:`${title} | Contacto`,
//dishes
})
})
app.listen(port, ()=>{
console.log('Funcionando en el puerto 3000')
})