-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
29 lines (24 loc) · 845 Bytes
/
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
require.paths.unshift(__dirname + '/lib');
require.paths.unshift(__dirname);
var connect = require('connect'),
config = require('./config/config'),
mongo = require('mongodb'),
Droplet = require('droplet').Droplet;
db = new mongo.Db('droplet', new mongo.Server(config.mongo_host, config.mongo_port, {}), {});
db.addListener("error", function(error) {
console.log("Error connecting to mongo -- perhaps it isn't running?");
});
db.open(function(p_db) {
var droplet = new Droplet();
droplet.init(db, function() {
var server = connect.createServer(function(req, res) {
try {
droplet.serveRequest(req, res);
} catch(e) {
droplet.handleError(req, res, e);
}
})
.listen(8080);
});
console.log('Tracking server running at http://*:' + config.tracking_port + '/tracking_pixel.gif');
});