-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
35 lines (26 loc) · 1004 Bytes
/
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 InitiateMongoServer = require('./config/db');
const authRoutes = require('./routs/authRoutes');
const cookieParser = require('cookie-parser')
const {requireAuth,checkUser, isAdmin,checkAdmin} = require('./middleware/authMiddleware')
const routerAdminBro = require('./adminPanel/adminBro')
const expController = require('./controllers/experienceController');
const app = express();
app.use(express.static('public'));
app.use(express.json());
// app.use(bodyParser.json());
app.set('view engine', 'ejs');
app.use(cookieParser());
app.use(authRoutes);
const PORT = process.env.PORT || 80;
InitiateMongoServer()
.then(() => {
app.listen(PORT, (req, res) => {
console.log('server is started');
console.log('Ready!!');
});
app.use('/admin', requireAuth, isAdmin,routerAdminBro);
});
app.get('*', checkUser);
app.get('/', expController.home_get );
app.get('/robotics',(req,res)=>{res.render('others')});