-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
34 lines (26 loc) · 1.05 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
const express = require('express');
// const http = require('http');
const app = express();
// const server = http.createServer(app);
const cors = require('cors');
app.use(cors())
const {PORT} = require('./config/config');
const registerLoginHandler = require('./routeHandler/registerLoginHandler')
const scheduleMailHandler = require('./routeHandler/scheduleMailHandler')
const sendMailHandler = require('./routeHandler/sendMailHandler')
const recurrMailHandler = require('./routeHandler/recurrMailHandler')
require('./config/db')();
app.use(function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
next();
});
app.use(express.urlencoded({extended: false}))
app.use(express.json());
app.use('/api/',registerLoginHandler);
app.use('/api/schedule/mail/',scheduleMailHandler);
app.use('/api/send/mail/',sendMailHandler)
app.use('/api/recurr/mail/',recurrMailHandler)
app.listen(PORT,()=>{
console.log(`Server running on port:${PORT}`);
});