-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
50 lines (34 loc) · 1.15 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
var express = require('express'), wApi = require('./server/wires-api');
var app = express();
var config = require('./config');
app.use(express.static(__dirname + '/app'));
//Route to serve all the wireframes exports
if(config.mediaPaths.indexOf('/') == 0) {
console.log("mediaPth : " + config.mediaPaths);
app.use('/media',express.static(config.mediaPaths));
} else {
console.log("mediaPth : " + __dirname + '/' + config.mediaPaths);
app.use('/media',express.static(__dirname + '/' + config.mediaPaths));
}
app.set('title', 'SOWT');
app.use('/rest/wires', function (req, res, next) {
wApi.wires(req,res);
});
app.use('/rest/wire/:id', function (req, res, next) {
wApi.wire(req,res);
});
//export png
var exec = require('child_process').exec,
child;
// child = exec('cat *.js bad_file | wc -l',
// function (error, stdout, stderr) {
// console.log('stdout: ' + stdout);
// console.log('stderr: ' + stderr);
// if (error !== null) {
// console.log('exec error: ' + error);
// }
// });
// Start server
app.listen(3000, function(){
console.log("Express server listening on port %d in %s mode", 3000, app.settings.env);
});