-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
60 lines (44 loc) · 1.71 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
55
56
57
58
59
60
var express = require('express'),
domo = require(__dirname + '/routes/domo');
var app = express();
app.set('view engine', 'jade')
app.configure(function () {
app.use(express.logger('dev')); /* 'default', 'short', 'tiny', 'dev' */
app.use(express.bodyParser());
});
/* API Functions
-------------------------------------------------- */
/* Devices
---------------------- */
app.get('/devices', domo.getDevices);
app.post('/device', domo.addDevice); // Create
app.get('/device/:id', domo.getDevice); // Read
app.put('/device/:id', domo.updateDevice); // Update
app.delete('/device/:id', domo.deleteDevice); // Delete
app.get('/device/data/:id', domo.getDeviceData);
app.get('/device/ask_data/:id', domo.getDeviceCurrentData);
app.post('/device/data/:id', domo.pushData);
app.post('/device/add_data/:id', domo.addData);
/* Rules
---------------------- */
app.get('/rules', domo.getRules); // GetAll
app.post('/rule', domo.addRule); // Create
app.get('/rule/:id', domo.getRule); // Read
app.put('/rule/:id', domo.updateRule); // Update
app.delete('/rule/:id', domo.deleteRule); // Delete
/* Spaces
---------------------- */
app.get('/spaces', domo.getSpaces); // GetAll
app.post('/space', domo.addSpace); // Create
app.get('/space/:id', domo.getSpace); // Read
app.put('/space/:id', domo.updateSpace); // Update
app.delete('/space/:id', domo.deleteSpace); // Delete
/* Protocols
---------------------- */
app.get('/protocols', domo.getProtocols); // GetAll
app.post('/protocol', domo.addProtocol); // Create
app.get('/protocol/:id', domo.getProtocol); // Read
app.put('/protocol/:id', domo.updateProtocol); // Update
app.delete('/protocol/:id', domo.deleteProtocol); // Delete
app.listen(3000);
console.log('Listening on port 3000');