Route using a Model - OCLC-Developer-Network/devconnect2018-idm GitHub Wiki

Displaying the User information

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

  1. Open server.js
  2. Find HTTP GET myaccount route
app.get('/myaccount', (req, res) => {
  1. Remove line
res.render('display-user'); 
  1. Use the User class to find the user information
    User.find(context.accessToken.getAccessTokenString())
    .then(user => {
        res.render('display-user', {user: user});
    })
    .catch (error => {
        // catch the error
    })