This repository was archived by the owner on Feb 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrentapRoutes.js
More file actions
26 lines (22 loc) · 1.79 KB
/
Copy pathrentapRoutes.js
File metadata and controls
26 lines (22 loc) · 1.79 KB
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
var express = require('express');
var router = express.Router();
var rentap_controller = require('./rentapController.js');
/* All the routes defined below are relative to /rentap because
* in app.js, there's a use /rentap as the router defined in
* this file
* i.e. app.use('/rentap', rentapRouter); where var rentapRouter = require('./routes/rentap');
*/
router.get('/', rentap_controller.show_new_ap); //home page is just blank ap
router.get('/show/:ap_id', rentap_controller.show_ap); //show particular ap for viewing/editing/discarding (or deleting/restoring if in trash)
router.get('/show/:ap_id/prev', rentap_controller.show_ap_prev); //prev & next skips trash items (or if in trash, skips not trash items)
router.get('/show/:ap_id/next', rentap_controller.show_ap_next);
router.get('/discard/:ap_id', rentap_controller.discard_ap);//just puts the rowid=ap_id in the trash table and shows next good ap
router.get('/show/:ap_id/switch_mode', rentap_controller.switch_mode); //for Trash and Back buttons, find the next ap_id in opposite mode
router.get('/restore/:ap_id', rentap_controller.restore_ap); //restores by removing rowid=ap_id from trash table
router.get('/delete/:ap_id', rentap_controller.rm_ap); //actually deletes the row from tbl, but only if in trash, then shows next in trash
router.get('/deleteheader/:headername', rentap_controller.rm_header); //deletes the header
router.get('/deleteheader', rentap_controller.rm_header); //deletes header with no name
router.post('*', rentap_controller.form_submission); //post can happen on any route because it's based on user clicking a button or pressing enter,
//so form_submission ignores the route and determines what to do from info on the form
//the result of a submission is to always go back to the route the post came from
module.exports = router;