forked from magnusstubman/perspective-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
executable file
·47 lines (35 loc) · 1.12 KB
/
server.js
File metadata and controls
executable file
·47 lines (35 loc) · 1.12 KB
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
#!/usr/bin/env node
var express = require('express');
var app = express();
var cons = require('consolidate');
var env = process.env;
var config = {
tasksUrl: env.TASKS_URL || "",
jenkinsUrl: env.JENKINS_URL || "",
jenkinsWebSocket: {
href: env.JENKINS_WS_HREF || "",
protocol: env.JENKINS_WS_PROTOCOL || ""
},
port: env.SERVER_PORT || ""
};
app.configure(function() {
app.use(express.compress());
app.engine('html', cons.mustache);
app.set('view engine', 'html');
});
app.configure('production', function() {
app.use(express.errorHandler());
app.set('views', __dirname + '/target/frontend-build/views');
app.use(express.static(__dirname + '/target/frontend-build/static'));
});
app.configure('development', function() {
app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
app.set('views', __dirname + '/src/views');
app.use(express.static(__dirname + '/src/static'));
});
app.all('*', function(request, response) {
response.render('index', {config: JSON.stringify(config)});
});
var port = config.port || 8000;
app.listen(port);
console.log("started server on " + port);