-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathserver.js
55 lines (39 loc) · 1.65 KB
/
server.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
var path = require('path');
var express = require('express');
var config = require('./config');
var routes = require('./routes/routes');
var app = express();
//
app.locals.public_version = 1;
app.locals.analytics = config.analytics;
app.use(express.cookieParser());
app.configure('development', function() {
app.use(express.logger('dev'));
app.get('/public/worker.js', routes.front.worker);
app.use('/public', express.static(path.join(__dirname, 'raw')));
app.use('/', express.static(__dirname));
app.use(express.static(__dirname + '/public'));
});
app.configure('testing', function() {
app.use(express.logger('dev'));
app.use('/public', express.static(path.join(__dirname, 'public')));
});
app.configure('production', function() {
app.enable('trust proxy');
});
app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
/*app.engine('html', require('jade').renderFile);
app.get('/', function(req, res) {
res.render('index.html');
});*/
app.get('/withdraw/:id', routes.api.tag, routes.front.withdraw);
app.post('/withdraw/:id', routes.api.tag, express.urlencoded(), routes.front.withdrawp);
app.get('/api/withdraw', routes.api.middleware, routes.api.tag, routes.api.withdraw);
app.get('/api/work', routes.api.middleware, routes.api.tag, routes.api.work);
app.get('/api/balance', routes.api.middleware, routes.api.tag, routes.api.balance);
app.post('/api/submit', routes.api.middleware, routes.api.tag, express.urlencoded(), routes.api.submit);
app.post('/api/email', routes.api.middleware, routes.api.tag, express.urlencoded(), routes.api.email);
var port = (process.env.NODE_PORT || config.server.port);
app.listen(port);
process.title = 'sv' + port;