-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
39 lines (22 loc) · 1.08 KB
/
server.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
const bodyparser = require('body-parser')
const express = require('express')
const app = express()
const control = require('./controllers')
app.use(bodyparser.urlencoded({extended:true}))
app.use(bodyparser.json())
app.use(control.middleware)
app.use('/web', express.static('public'))
app.post('/login', control.login)
app.get('/notification', control.notificate)
app.get('/devices', control.getDevices )
app.get('/device/:id/measure/:measureID', control.getMeasure )
app.post('/device/:id/measure', control.addMeasure )
app.get('/device/:id/measures', control.getMeasures )
app.get('/device/:id/recommendation/:recommendationID', control.getRecommendation )
app.post('/device/:id/recommendation', control.addRecommendation )
app.get('/device/:id/recommendations', control.getRecommendations )
app.get('/device/search', control.searchDevice )
app.delete('/device/:id', control.deleteDevice)
app.delete('/device/:id/recommendation/:recommendationID', control.deleteRecommendation )
const PORT = 8080
app.listen(PORT, _ => console.log(`Servidor web escuchando en puerto ${PORT}`))