-
Notifications
You must be signed in to change notification settings - Fork 1
/
routes.js
39 lines (35 loc) · 871 Bytes
/
routes.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
module.exports = (app, db) => {
app.get('/', (req, res) => {
console.log('DOCKER LIVE')
db.collection('pvdata').find({}).toArray((err, item) => {
if (err) {
console.log(err)
res.send({'error':'An error has occurred'})
} else {
if(item[0]) {
res.send({
general1: item[0].general,
general2: item[0].general,
project1: item[0].projects,
project2: item[0].projects,
seminar1: item[0].seminars,
seminar2: item[0].seminars
})
}
else {
res.send({
general1: {},
general2: {},
project1: {},
project2: {},
seminar1: {},
seminar2: {}
})
}
}
})
})
app.put('/new', (req, res) => {
res.send('Success')
})
}