forked from etsy/Sahale
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
73 lines (62 loc) · 2.56 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
61
62
63
64
65
66
67
68
69
70
71
72
73
// the app's dependencies
var express = require('express')
, routes = require('./routes')
, http = require('http')
, path = require('path')
, bodyParser = require('body-parser')
, favicon = require('serve-favicon')
, logger = require('morgan')
, methodOverride = require('method-override');
// customize this to taste
var listen_port = 5735;
var app = express();
app.set('port', listen_port);
app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
app.disable('etag');
app.use(favicon(__dirname + '/public/images/favicon.ico'));
app.use(logger('dev'));
app.use(bodyParser.urlencoded({ extended: true, limit: '5mb' }));
app.use(bodyParser.json({ extended: true, limit: '5mb' }));
app.use(methodOverride('_method'));
app.use(require('stylus').middleware(__dirname + '/public'));
app.use(express.static(path.join(__dirname, 'public')));
if (app.get('env') == 'development') {
app.locals.pretty = true;
}
// Views
app.get('/', routes.index);
app.get('/help', routes.help);
app.get('/flowgraph/:flow_id', routes.flowgraph);
app.get('/history/:flow_name', routes.history);
app.get('/load/:cluster', routes.load);
app.get('/search', routes.search);
// JSON API for db reads
app.get('/flows/running', routes.flows_running);
app.get('/flows/completed', routes.flows_completed);
app.get('/flows/completed/all/ids', routes.flows_completed_all_ids);
app.get('/flows/search/:searchterm', routes.flow_search);
app.get('/flow/:flow_id', routes.flow);
app.get('/steps/:flow_id', routes.steps);
app.get('/edges/:flow_id', routes.edges);
app.get('/flow_history/:flow_name', routes.flow_history);
app.post('/step_group', routes.step_group); // read only but uses POST due to param size
app.get('/sahale_config_data', routes.sahale_config_data);
app.get('/agg/flow/:flow_id', routes.agg_by_flow);
app.get('/agg/time/:start/:end', routes.agg_by_epoch_start_end);
/**
* DEPRECATED
* Use '/flows/completed/all/ids' and the individual flow API.
*/
app.get('/flows/completed/all', routes.flows_completed_all);
// JSON API routes & handlers for POSTed data from running Cascading jobs
app.post('/flow/update/:flow_id', routes.insert_or_update_flow);
app.post('/steps/update/:flow_id', routes.insert_or_update_steps);
app.post('/edges/update/:flow_id', routes.insert_or_update_edge);
app.post('/agg/update/:flow_id', routes.insert_flow_agg);
// set the running binary's console display name
process.title = "sahale"
http.createServer(app).listen(app.get('port'), function() {
console.log("Sahale has started successfully.");
console.log("Express server listening on port " + app.get('port'));
});