The example in the reference page for this blueprint endpoint on sailsjs.org assumes "rest" blueprints are enabled, and that your project contains at least an empty 'Employee' model as well as a Store
model with association: employeesOfTheMonth: {collection: 'Employee'}
. You'll also need at least an empty StoreController
and EmployeeController
. You can quickly achieve this by running:
$ sails new foo
$ cd foo
$ sails generate api store
$ sails generate api employee
...then editing api/models/Store.js
:
module.exports = {
attributes: {
employeesOfTheMonth: {collection: 'Employee'}
}
};
You will then need to create a store with an employeesOfTheMonth
collection as described >here, e.g. with a POST payload of:
{
"name": "Starbucks",
"id": 16,
"employeesOfTheMonth": [
{
"name": "Dolly"
}
]
}
To find Dolly's id (e.g. 7
):
http://localhost:1337/store/16
Then remove her from the collection: DELETE /store/16/employeesOfTheMonth/7
.
Good luck!
Thanks @jodonnell-broadsoft!