-
Notifications
You must be signed in to change notification settings - Fork 0
/
api.js
72 lines (57 loc) · 1.41 KB
/
api.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
61
62
63
64
65
66
67
68
69
70
71
//RESTFUL API
var express = require('express');
var app = express();
app.post('/api/projects', function(req, res) {
console.log("Creating new project");
res.json({
pr_id:"73z7vtv"
});
});
app.post('/api/participants', function(req, res) {
console.log("Creating new participant");
res.json({
pa_id: "ymaagxo",
pa_project: "73zyvtv",
});
});
app.post('/api/calibrations', function(req, res) {
console.log("Creating new calibration")
res.json( {
ca_id: "xsfsgsg"
})
});
app.post('/api/calibrations/:id/start', function(req, res) {
console.log("Start calibrations " + req.params.id);
res.json({
ca_state: "start"
});
});
app.get('/api/calibrations/:id/status', function(req, res) {
console.log("Check the status of calibrations " + req.params.id);
res.json({
ca_state: "calibrated"
});
})
app.post('/api/recordings', function(req, res) {
console.log("Creating new recording")
res.json({
rec_id: "aasgasg"
})
});
app.post('/api/recordings/:id/start', function(req, res) {
console.log("Start recording " + req.params.id);
res.json({
re_state: "start"
});
});
app.post('/api/recordings/:id/stop', function(req, res) {
console.log("Stop recording " + req.params.id);
res.json({
re_state: "stop"
});
});
var server = app.listen(80, function() {
var host = server.address().address
var port = server.address().port
console.log("Example app listening at http://%s:%s", host, port);
})