-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathindex.js
More file actions
41 lines (36 loc) · 1.23 KB
/
index.js
File metadata and controls
41 lines (36 loc) · 1.23 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
global.express = require('express');
global.app = express();
global.colors = require('colors');
global.fastBomber = require('./modules/sms.js');
global.mongoose = require('mongoose');
global.moment = require('moment');
global.Schema = mongoose.Schema;
global.bodyParser = require('body-parser');
global.config = require('./config.js');
global.cron = require('node-cron');
global.cookieParser = require('cookie-parser');
mongoose.connect(config.mongodb, { useNewUrlParser: true, useUnifiedTopology: true });
mongoose.connection.on('open', () => {
console.log(`MongoDB Connected`.green);
});
global.userModel = require('./models/user.js');
global.limitModel = require('./models/limit.js');
cron.schedule('0 0 * * *', async () => {
await limitModel.deleteMany({});
console.log(`Limitler Sifirlandi`.green);
});
require('./routers/router.js')(this);
(async () => {
const umail = 'fastuptime@gmail.com';
const check = await userModel.findOne({ email: umail });
if (check) return;
new userModel({
name: 'Admin',
email: umail,
role: 'admin',
password: 'admin',
}).save();
})();
app.listen(80, () => {
console.log(`Fast SMS Bomber Started`.green);
});