From 2a1519e1bb79f10c90090a5f158b32e9005d0869 Mon Sep 17 00:00:00 2001 From: "Arren Matthew C. Antioquia" Date: Sat, 28 Mar 2020 16:08:39 +0800 Subject: [PATCH] Added routes.js --- routes/routes.js | 52 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 routes/routes.js diff --git a/routes/routes.js b/routes/routes.js new file mode 100644 index 0000000..de5db61 --- /dev/null +++ b/routes/routes.js @@ -0,0 +1,52 @@ + +// import module `express` +const express = require('express'); + +// import module `controller` from `../controllers/controller.js` +const controller = require('../controllers/controller.js'); + +// import module `signupController` from `../controllers/signupController.js` +const signupController = require('../controllers/signupController.js'); + +// import module `successController` from `../controllers/successController.js` +const successController = require('../controllers/successController.js') + +// import module `profileController` from `../controllers/profileController.js` +const profileController = require('../controllers/profileController.js'); + +const app = express(); + +// execute function getFavicon() +// defined in object `controller` in `../controllers/controller.js` +// when a client sends an HTTP GET request for `/favicon.ico` +app.get('/favicon.ico', controller.getFavicon); + +// execute function getIndex() +// defined in object `controller` in `../controllers/controller.js` +// when a client sends an HTTP GET request for `/` +app.get('/', controller.getIndex); + +// execute function getSignUp() +// defined in object `signupController` in `../controllers/signupController.js` +// when a client sends an HTTP GET request for `/signup` +app.get('/signup', signupController.getSignUp); + +// execute function postSignUp() +// defined in object `signupController` in `../controllers/signupController.js` +// when a client sends an HTTP POST request for `/signup` +app.post('/signup', signupController.postSignUp); + +// execute function getSuccess() +// defined in object `successController` in `../controllers/successController.js` +// when a client sends an HTTP GET request for `/success` +app.get('/success', successController.getSuccess); + +// execute function getProfile() +// defined in object `profileController` in `../controllers/profileController.js` +// when a client sends an HTTP GET request for `/profile/:idNum` +// where `idNum` is a parameter +app.get('/profile/:idNum', profileController.getProfile); + +// exports the object `app` (defined above) +// when another script exports from this file +module.exports = app;