-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
31 lines (31 loc) · 1.02 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
const express = require('express');
const app = express();
const port = process.env.PORT || 8080;
const insertRouter = require('.//routes/Index');
const path = require('path');
const { mySqlRouter } = require('./routes/MySql');
const showTableRouter = require('./routes/receivers');
const {preparationRouter} = require('./routes/prepare');
const mailSendRouter = require('./routes/modalinfo');
const bodyParser = require('body-parser');
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'ejs');
app.use(express.urlencoded({limit: '20mb', extended: true}))
app.use('/', insertRouter);
app.use('/', mySqlRouter);
app.use('/', showTableRouter);
app.use('/', preparationRouter);
app.use('/', mailSendRouter);
app.use(bodyParser.json({limit: '20mb'}));
app.get('/', (req,res) => {
res.redirect('/receiver-list');
})
app.use("/public/", express.static('./public/'))
app.listen(port, (error) => {
if (error) {
throw error;
}
else {
console.log(`Server is listening on port: ${port}`);
}
})