-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathscancamera.js
executable file
·87 lines (47 loc) · 1.57 KB
/
scancamera.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
var express = require('express');
var fs = require('fs');
var cameralogic = require('./cameralogic');
var app = express()
var server = app.listen(3000, function () {
var host = server.address().address
var port = server.address().port
console.log('Example app listening at http://%s:%s', host, port)
})
app.use(express.static('public'));
app.use(express.static('pictures'));
app.use(express.static('raw'));
// respond with "Hello World!" on the homepage
app.get('/', function (req, res) {
res.send('Hello World!');
})
app.get('/preview/', function (req, res) {
res.send('starting scan at lowest definition for preview!');
//TODO : call here whatever logic is needed for a scan
})
app.get('/snap/', function (req, res) {
if(cameralogic.snap(cameralogic.SD)){
res.send('starting scan at standard definition!');
}else{
res.send('cannot scan yet, the camera is already in use !');
}
})
app.get('/snap/:definition', function (req, res) {
res.send('starting scan!');
//TODO : call here whatever logic is needed for a scan
})
app.get('/collection', function (req, res) {
res.send('list of images!');
//TODO : return here the list of the pictures already taken
})
app.get('/picture/:id', function (req, res) {
res.send('the picture!');
//TODO : return here the considered image
})
app.get('/raw/:id', function (req, res) {
res.send('the raw picture!');
//TODO : return here the considered image
})
app.get('/picture/last', function (req, res) {
res.send('the last picture!');
//TODO : return here the last pictures taken
})