-
Notifications
You must be signed in to change notification settings - Fork 6
/
global.js
39 lines (31 loc) · 819 Bytes
/
global.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
// Generated by CoffeeScript 1.6.3
(function() {
var path;
path = require('path');
global.getNextId = function(name, callback) {
return global.db.collection('counters').findAndModify({
_id: name
}, [['_id', 'asc']], {
$inc: {
seq: 1
}
}, {
"new": true
}, callback);
};
global.resumable = require('./modules/resumable-node.js')(path.join(__dirname, '/temp/'));
global.STATUS_SUCCESS = 'success';
global.STATUS_ERROR = 'error';
global.json_response = function(res, status, data, message, page) {
var json;
res.set('Content-Type', 'application/json');
json = JSON.stringify({
status: status,
data: data,
message: message,
page: page
});
return res.end(json);
};
module.exports = global;
}).call(this);