forked from kshitijanand36/Election-Corruption
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
60 lines (41 loc) · 1.28 KB
/
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
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
58
59
//! for securing credentials of MongoDB Atlas
require('dotenv').config();
//! importing dependencies
const express = require("express");
const ejs = require("ejs");
const app = express();
const _ = require('lodash');
const mongoose = require("mongoose");
//! Routers
const DeleteRouter = require('./routes/Delete')
const UpdateRouter = require('./routes/Update');
const ReportsRouter = require('./routes/Reports')
const ComposeRouter = require('./routes/Compose')
const ReportRouter = require('./routes/Report')
const LatestRouter = require('./routes/Latest');
const HomeRouter = require('./routes/Home');
//! Use Routers
app.use(DeleteRouter);
app.use(UpdateRouter);
app.use(ReportsRouter);
app.use(ComposeRouter);
app.use(ReportRouter);
app.use(LatestRouter);
app.use(HomeRouter);
//! Set View Engine
app.set('view engine', 'ejs');
//! Serve static files
app.use(express.static("public"));
//! for local testing and development .
mongoose.connect('mongodb://localhost:27017/ElectionCorruption',{
useNewUrlParser : true,
useUnifiedTopology:true
})
//! for deployment
// mongoose.connect(process.env.DB_LINK,{
// useNewUrlParser: true,
// useUnifiedTopology: true
// });
app.listen(process.env.PORT || 3000 , ()=> {
console.log("Server started on port 3000");
});