-
-
Save pantchox/be8023b6d3850de0dae48790e63abd4f 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
// i want all the index - /api/bookLists | |
// BookLists is the model import | |
export const index = ({ user }, res, next) => | |
BookLists.find({ user: user.id}) | |
.populate('user') | |
.populate('books') | |
.then((bookLists) => bookLists.map((bookLists) => bookLists.view(true))) // this is a call to the Model method of view | |
.then(success(res)) | |
.catch(next) | |
// the '/' route is fine its a inner level routing being handled by a router, it gets there thats the point. | |
router.get('/', | |
token({ required: true }), | |
query(), | |
index) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment