-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
111 lines (90 loc) · 2.45 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/**
* DyNAMiC Workbench
* Copyright (c) 2011 Casey Grun, Molecular Systems Lab, Harvard University
*
* PRE-RELEASE CODE. DISTRIBUTION IS PROHIBITED.
*/
var express = require('express'),
app = express.createServer(),
winston = require('winston'),
fm = require('./server/file-manager'),
tools = require('./server/server-tools'),
auth = require('./server/node_modules/auth');
// var Schema = mongoose.Schema,
// UserSchema = new Schema({});
// UserSchema.plugin(mongooseAuth, {
// facebook: true
// });
app.configure('production',function() {
app.set('env','production');
});
app.configure('development', function () {
app.set('env','development');
})
app.configure(function() {
console.log('Environment: ' + app.set('env'));
app.set('invite', ['yinlab-workbench','mpp']);
app.set('views', __dirname + '/views');
app.set('baseRoute', '/');
app.use(express.bodyParser());
app.use(express.cookieParser());
app.use(express.session({
secret : 'infomachine2'
}));
app.use(express.limit('10mb'));
// logging
winston.remove(winston.transports.Console);
winston.add(winston.transports.Console, {
colorize : true
});
winston.add(winston.transports.File, {
filename : 'logs/full.log',
timestamp: true,
json: true,
maxsize: 1024 * 1024 * 1024,
});
// static file server
app.use(express['static'](__dirname + '/static'));
// auth
auth.configure(app, express);
// application landing page
app.get('/',auth.restrict('html'), function(req, res) {
res.render('index.jade', {
manifest: require('./server/manifest'),
env: app.set('env'),
layout : false
});
});
app.get('/popup.html', function (req, res) {
res.render('popup.jade', {
manifest: require('./server/manifest'),
env: app.set('env'),
layout : false
});
})
// configure file manager
fm.configure(app, express);
// configure server-side tools
tools.configure(app, express);
});
app.configure('development', function () {
// TODO: Add to local configuration environment
app.get('/build.html', function(req, res) {
res.render('build.jade', {
manifest: require('./server/manifest'),
env: app.set('env'),
layout : false
});
});
// TODO: Add to local configuration environment
app.get('/tests.html', function(req, res) {
res.render('tests.jade', {
manifest: require('./server/manifest'),
env: app.set('env'),
layout : false
});
});
})
port = 3000;
app.listen(port);
console.log('Server running from ' + __dirname + ' at on port ' + port);