I am currently working on a web app and want to design the interface between nodejs / mongoose and the backbone app.
A short description of the app:
A user signs up to the application and gets a user account where he can create an organization (e.g. footballclub). Within these organizations you can set up projects. Within these projects you can define tasks you could assign to somebody)
I want to have a RESTful api for the app. My problem is: A user could have more than one organization, if i have an api for projects like
GET /projects/
POST /projects/
GET /projects/:id
PUT /projects/:id
DELETE /projects/:id
How do i determine to which organization the project belongs? Do i add a parameter to the api or do i send an extra field containing the id of the organization? Any help is appreciated!
GET /organizations/projects/:id
Gets a list of projects for an organization.
POST /projects/:id
Updates a specific project.
GET /projects/:id
Gets a specific project.
DELETE /projects/:id
Deletes a specific project.
DELETE /organizations/:id
Deletes an organization and all it’s projects.
POST /organizations/:id
Updates a specific organization.
GET /organizations
Gets a list of all organizations