Skip to content

Route using a Model

Karen Coombs edited this page Jul 10, 2018 · 1 revision

In order to display the actual ILL Request data we have to retrieve it from the API and pass it to our view.

  1. Open server.js
  2. Find HTTP POST request route
app.get('/request', (req, res) => {
  1. Remove line
res.render('display-request'); 
  1. Use the ILLRequest class to create an ILLRequest and display the associated information
    ILLRequest.add(config['institution'], app.get('accessToken').getAccessTokenString(), fields)
        .then(ill_request => {
            res.render('display-request', {request: ill_request});
        })
        .catch (error => {
            // catch the error
        })

Clone this wiki locally