-
Notifications
You must be signed in to change notification settings - Fork 14
/
server.js
38 lines (33 loc) · 1.25 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
var express = require('express');
var _ = require('underscore');
var http = require('http');
var app = express();
var server = require('http').createServer(app);
var accountController = require('./server/controllers/accountController');
var historyController = require('./server/controllers/historyController');
var homeController = require('./server/controllers/homeController');
var pulse = require('./server/controllers/pulseController');
var redis = require("redis");
var pomodoro = require("./server/models/pomodoro");
//setup a redis client based on if the environment is development or production
//var client = redis.createClient();
String.prototype.bool = function() {
return (/^true$/i).test(this);
};
app.set('view engine', 'ejs');
app.set('view options', { layout: false });
app.use('/public', express.static('public'));
app.use('/public', express.static('bower_components'));
app.use(express.methodOverride());
app.use(express.bodyParser());
app.use(express.cookieParser());
app.use(express.session({ secret: process.env.twilioAccountSid }));
app.use(app.router);
accountController.init(app);
historyController.init(app);
homeController.init(app);
pulse.init(app);
server.listen(process.env.PORT || 3000);
setInterval(function() {
pomodoro.tick();
}, 1000);