Jason
Jason

Reputation: 31

SailsJS populate blueprint routes not working on Windows

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.

Upvotes: 0

Views: 895

Answers (2)

Jason
Jason

Reputation: 31

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.

Upvotes: 1

Bulkin
Bulkin

Reputation: 1040

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

Read Blueprint API populate more carefully

Upvotes: 2

Related Questions