This repository has been archived by the owner on Oct 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main-server.js
48 lines (40 loc) · 1.3 KB
/
main-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
39
40
41
42
43
44
45
46
47
48
const express = require('express'),
app = express(),
mongoose = require('mongoose'),
PORT = 3000,
userRoutes = require('./routes/users'),
dashroutes = require('./routes/dashboard'),
filesroutes = require('./routes/files'),
indexRoutes = require('./routes/index'),
User = require('./models/user')
Files = require('./models/file'),
seedDB = require('./seeds'),
middleware = require('./middleware/index'),
logger = require('./logger/logs'),
multer = require('multer'),
dld = require('download');
require('dotenv').config();
mongoose.connect(process.env.localDatabase, {
}).then(() =>{
logger('Arcane DB has been connected successfully!');
}).catch(err => {
console.err("ERROR",err.message);
});
var RateLimit = require('express-rate-limit');
var limiter = RateLimit({
windowMs: 15 * 60 * 1000,
max: 100
});
app.use(limiter);
logger('I Love Computers - CyberRodeo');
// seedDB.seed();
app.set("view engine", "ejs");
app.use(express.static(__dirname + "/public"));
app.use(express.static('public'));
app.use(indexRoutes);
app.use("/dashboard", dashroutes);
app.use("/user", userRoutes);
app.use("/file", filesroutes);
app.listen(PORT || process.env.PORT, process.env.IP, function(){
logger("Arcane server is up on PORT:", PORT)
});