-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathroutes.js
42 lines (33 loc) · 1.19 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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
const express = require('express');
const path = require('path');
const router = express.Router();
const bodyParser = require('body-parser');
const applicationController = require('./applicationController')
const app = express();
// Set Render Engine to EJS
app.use('/public', express.static('public'));
app.set('view engine', 'ejs');
// Use Body-parser to handle JSON responses
router.use(bodyParser.urlencoded({extended: true}));
router.use(bodyParser.json());
// GET: Home Route
router.get('/', async (req, res) => {
res.render('newMerchantApplication');
});
// POST: Create Application
router.post('/create-application', async (req, res, next) => {
applicationController.createApplication(req, res, next);
});
// POST: Update Application
router.post('/update-application', async (req, res, next) => {
applicationController.updateApplication(req, res, next);
});
// POST: Send Application to Merchant
router.post('/send-application', async (req, res, next) => {
applicationController.sendApplication(req, res, next);
});
// POST: Submit Application
router.post("/submit-application", (req, res, next) => {
applicationController.submitApplication(req, res, next);
});
module.exports = router;