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.
- Open server.js
- Find HTTP GET myaccount route
app.get('/myaccount', (req, res) => {
- Remove line
res.render('display-user');
- 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
})