I'm having a bit of trouble figuring out how to create my angular resource properly.
.factory('Favorite', function ($resource) {
return $resource('/api/user/:id/favorites/:verb/:favid', {
id: "@_id",
favid: "@favid"
}, {
jobs: {
method: 'GET',
params: {
verb: 'jobs'
}
},
resumes: {
method: 'GET',
params: {
verb: 'resumes'
}
}
});
});
The trick is I want to provide a list function at /api/user/:id/favorites
that lists all types of favorites (jobs, etc).
However each favorite type needs to have a CRUD interface for it.
So I also need to support GET/PUT/POST/DELETE for /api/user/:id/favorites/jobs/:jobid
I'm not really sure if I'm doing this right, nor do I know if I can actually do CRUD operations where the jobs
and resumes
are defined or how I would actually call them.