-
Notifications
You must be signed in to change notification settings - Fork 6
/
app.js
36 lines (27 loc) · 910 Bytes
/
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
const express = require('express');
const bodyParser = require('body-parser');
const path = require('path');
const app = express();
const rootDir = require('./utils/path');
const db = require('./utils/connection');
const adminRoutes = require('./routes/admin');
const dashboardRoutes = require('./routes/dashboard');
const getdataRoutes = require('./routes/getdata');
const nodeapiRoutes = require('./routes/nodeapi');
const mongoRoutes = require('./routes/mongo');
app.use(bodyParser.urlencoded({
extended: false
}));
app.use(bodyParser.json());
app.use(express.static(path.join(rootDir, 'public')));
app.use(adminRoutes);
app.use(getdataRoutes);
app.use(nodeapiRoutes);
app.use(mongoRoutes);
app.use(dashboardRoutes);
app.use((req, res, next) => {
res.status(404).sendFile(path.join(rootDir, 'views', '404.html'));
});
app.listen(3000, () => {
console.log("Server live at port 3000")
});