0

I am new to sails.js and I am attempting to get up to speed on the API built-ins. I have an authenticated API up and running for a sample library app that I am building.

The app is pretty simple. I have a Book model that contains the relevant book data. A User has a many-to-many relationship with a Book. When I perform GET /book, all of the books stored in the DB are returned.

My question is, what is the best way to return only the books that the current user is associated with? The blueprint API calls for populate (/user/1/books) returns 404.

Jason
  • 31
  • 6

2 Answers2

2

For user with ID 1 that will be: GET /user/1/book

Read Blueprint API populate more carefully

Bulkin
  • 1,020
  • 12
  • 27
1

Turns out this was a bug in Sails 0.11 on Windows. I just assumed since the populate blueprint routes weren't working out the box I had missed something. Thanks for the answers! Here is the fix.

Jason
  • 31
  • 6
  • I think I experimenting the same issue on Ubuntu 18.10. Did you had to change any config on windows or did they fix on source code? – Jordi May 24 '19 at 10:37