-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
57 lines (47 loc) · 1.41 KB
/
index.js
File metadata and controls
57 lines (47 loc) · 1.41 KB
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
var express= require('express');
var mongoOpen= require('./core/db/mongodb/mongodb.js');
var app= express();
app = require('./core/bootstrap/initialize')(app);
// module.exports= function (port) {
// mongoOpen.connectToServer( function( err ) {
// if(err)
// throw err;
// //Initiate bruteForce Object Creation
// require('./core/middleware/rateLimit/bruteForceObject').createObject();
// require('./core/indexing/indexing')()
// .then(function (res) {
// console.log("Response of indexing",res);
// });
// var PORT= port || 1337;
// console.log('Running Server on port '+PORT);
// app.listen(PORT);
// });
// }
var quailApp={
app: function () {
return app;
},
listen: function (port,cb) {
mongoOpen.connectToServer( function( err ) {
if(err)
throw err;
//Initiate bruteForce Object Creation
require('./core/middleware/rateLimit/bruteForceObject').createObject();
require('./core/indexing/indexing')()
.then(function (res) {
// console.log("Response of indexing",res);
})
.catch(function (err) {
console.log("Error while starting app : ",err);
var db= require('./core/db/mongodb/mongodb.js').getDb();
db.collection('QuailErrors').insert({date:new Date(),label:'critical',err:err})
.then(function (errors) {
});
});
var PORT= port || 1337;
// console.log('Running Server on port '+PORT);
app.listen(PORT,cb);
});
}
}
module.exports= quailApp;