-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathroutes.js
25 lines (20 loc) · 1.05 KB
/
routes.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
const express = require('express');
const route = express.Router();
const homeController = require('./src/controllers/homeController');
const loginController = require('./src/controllers/loginController');
const contactController = require('./src/controllers/contactController');
const {loginRequired} = require('./src/middlewares/middleware');
// -- HOME ROUTES
route.get('/', homeController.index);
// -- LOGIN ROUTES
route.get('/login/index' , loginController.index);
route.post('/login/register', loginController.register);
route.post('/login/login', loginController.login);
route.get('/login/logout', loginController.logout);
// -- CONTACT ROUTES | loginRequired = my middleware
route.get('/contact/index',loginRequired, contactController.index);
route.post('/contact/register',loginRequired, contactController.register);
route.get('/contact/index/:id',loginRequired, contactController.editIndex);
route.post('/contact/edit/:id',loginRequired, contactController.edit);
route.get('/contact/delete/:id',loginRequired, contactController.delete);
module.exports = route;