-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
57 lines (50 loc) · 1.76 KB
/
index.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
55
56
57
var createError = require('http-errors');
var express = require('express');
const port = process.env.PORT || 3000;
var bodyParser = require('body-parser')
var path = require('path');
var cookieParser = require('cookie-parser');
var logger = require('morgan');
const homeRouter = require('./routes/home')
const studentRegister = require('./routes/student-register')
const signRouter = require("./routes/student-login")
const adminRouter = require("./routes/admin-login")
const facultyRouter = require('./routes/f-dashboard')
const facultySigninRoute = require("./routes/faculty-login")
const registerRouter = require("./routes/register")
const studentRouter = require("./routes/s-dashboard")
var app = express();
app.set('view engine', 'ejs');
app.use(logger('dev'));
app.use(bodyParser.json({ limit: '10mb', extended: true }));
app.use(bodyParser.urlencoded({ limit: '10mb', extended: true }));
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));
const mongoose = require('mongoose')
mongoose
.connect('mongodb+srv://attenderdp:[email protected]/test', {
useNewUrlParser: true,
useUnifiedTopology: true,
})
.then(() => {
console.log('connected');
})
.catch((err) => {
console.log('not connected',err);
});
app.get("/test",(req,res)=>{
res.render('testing',{})
})
app.use('/', homeRouter);
app.use('/student-login',signRouter);
app.use('/admin-login',adminRouter);
app.use('/student-register',studentRegister);
app.use('/f-dashboard',facultyRouter);
app.use('/s-dashboard',studentRouter);
app.use('/faculty-login',facultySigninRoute);
app.use('/register',registerRouter);
app.listen(port,(req,res)=>{
console.log("up and running")
})