-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
54 lines (36 loc) · 1.51 KB
/
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
49
50
51
52
53
54
const express = require('express');
const bodyParser = require('body-parser');
const path = require('path');
const { config, engine } = require('express-edge');
config({ cache: process.env.NODE_ENV === 'production' });
const mongoose = require('mongoose');
const notificationMail = require('./email/notificationMail');
var configDb = require('./config/db');
// mongoose.connect('mongodb://localhost/TrackMe');
mongoose.connect(configDb.getDbConnectionString());
const app = new express();
app.use(express.static('public'));
app.use(engine);
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true}));
app.set('views',`${__dirname}/views`);
const homePageController = require('./controllers/homePage');
const storeController = require('./controllers/storeProductDetails');
const emailExistController = require('./controllers/emailExist');
const otpAuthController = require('./controllers/otpAuth');
const unsubscribeController = require('./controllers/unsubscribed');
app.get('/',homePageController);
app.post('/form/store',storeController);
app.post('/emailExist',emailExistController);
app.post('/otpAuth',otpAuthController);
app.get('/unsubscribe/:id', unsubscribeController);
function intervalFxn(){
console.log('-----Checking for price drop-----',new Date().toLocaleTimeString());
notificationMail();
}
notificationMail();
// setInterval(intervalFxn, 3*60*60*1000);
app.use((req, res)=> res.render('notFound'));
app.listen(process.env.PORT || 1007,()=>{
console.log("App listen on Port 1007");
});