forked from vedanshagarwal4/shareMate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
router.js
54 lines (47 loc) · 1.97 KB
/
router.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
const express = require('express');
const Authentication = require('./authentication');
const appRouter = express.Router();
const profileRouter = express.Router();
const acceptRouter = express.Router();
const feedRouter = express.Router();
const pendingRequestRouter = express.Router();
const Render = require('./controllers/render');
appRouter.get("/",(req,res)=>{
res.render("index1");
});
appRouter.get("/error",Render.handle);
appRouter.get("/signup",(req,res)=>{
res.render("signup");
});
appRouter.get("/login",(req,res)=>{
res.render("login");
});
appRouter.post("/new",Authentication.signup);
appRouter.post("/old",Authentication.login);
appRouter.get("/request",Render.head);
appRouter.get('/logout',Authentication.logout);
appRouter.get('/log',(req,res) => {
res.redirect('/');
});
appRouter.get('/invite',Authentication.invite);
// appRouter.get('/emailVal',Authentication.emailVal);
appRouter.post('/addrequest',Authentication.request);
appRouter.post('/acceptrequest',Authentication.acceptrequest);
appRouter.post('/deleterequest',Authentication.deleterequest);
appRouter.use('/profile',profileRouter);
profileRouter.use(express.static(__dirname + '/public'));
profileRouter.get('/:currentUser',Authentication.profile);
appRouter.use('/accepted',acceptRouter);
acceptRouter.use(express.static(__dirname + '/public'));
acceptRouter.get('/:currentUser',Render.acceptedRequests);
appRouter.post('/reopen',Authentication.reopen);
appRouter.post('/close',Authentication.close);
appRouter.get('/leaderboard',Render.leaderboard);
appRouter.use('/feedback',feedRouter);
feedRouter.use(express.static(__dirname + '/public'));
feedRouter.get('/:roll',Authentication.feedback);
appRouter.use('/pendingRequests',pendingRequestRouter);
pendingRequestRouter.use(express.static(__dirname + '/public'));
pendingRequestRouter.get('/:currentUser',Render.pendingRequests);
appRouter.post('/editrequest',Authentication.editrequest);
module.exports = appRouter;