Created
July 14, 2016 19:30
-
-
Save joshgrib/87caa6ced7455c970c638c86b0a58943 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Single Person Page | |
router.get("/:id", (req, res) => { | |
// Find a person by the provided id, | |
// then display their information | |
// As well as listing all events that they will be attending | |
// Each of these events need to link to the event page, and show the event name | |
// If a person is not found, display the 404 error page | |
data.people.getPerson(req.params.id).then( (person_info) => { | |
return data.events.getEventsForAttendee(person_info.id).then( (event_info) => { | |
person_info.events = event_info; | |
return person_info; | |
}); | |
}).then( (person_info) => { | |
res.render("layouts/person", person_info); | |
}).catch((e) => { | |
res.status(404).render('404', {error: e}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment