-
Notifications
You must be signed in to change notification settings - Fork 0
Route Basics
Karen Coombs edited this page Jul 10, 2018
·
1 revision
Our application is supposed to have two "screens":
- "home" screen
- Display screen user information To make our application work we have to tell it what urls to use for those two screens.
- Open the server.js file
- Define the route for the search screen
- Add the HTTP method which will be used
- Add the "path"
- Return the view you want the application to display in the response
app.get('/', (req, res) => {
res.render('index', {user_id: app.get('accessToken').getUser().principalID});
});
- Define a basic routes for the screen to display user information
app.post('/request', (req, res) => {
let fields = {
"needed": req.body.needed,
"userID": req.body.userID,
"ItemOCLCNumber": req.body.ItemOCLCNumber,
"ItemTitle": req.body.ItemTitle,
"ItemAuthor": req.body.ItemAuthor,
"ItemMediaType": req.body.ItemMediaType,
};
res.render('display-request');
});