Skip to content

Instantly share code, notes, and snippets.

@joshgrib
Created July 14, 2016 19:30
Show Gist options
  • Save joshgrib/87caa6ced7455c970c638c86b0a58943 to your computer and use it in GitHub Desktop.
Save joshgrib/87caa6ced7455c970c638c86b0a58943 to your computer and use it in GitHub Desktop.
// 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