We will start our project by first documenting all of the routes and data models for our API. Following best practices we will use verbs to specify the type of operation being done and nouns when naming endpoints.
HTTP verb | URL | Request body | Action |
---|---|---|---|
GET | /api/projects |
(empty) | Returns all the projects |
POST | /api/projects |
JSON | Adds a new project |
GET | /api/projects/:projectId |
(empty) | Returns the specified project |
PUT | /api/projects/:projectId |
JSON | Edits the specified project |
DELETE | /api/projects/:projectId |
(empty) | Deletes the specified project |
HTTP verb | URL | Request body | Action |
---|---|---|---|
POST | /api/tasks |
JSON | Adds a new task |
{
title: String,
description: String,
tasks: [ { type: Schema.Types.ObjectId, ref: 'Task' } ]
}
{
title: String,
description: String,
project: { type: Schema.Types.ObjectId, ref: 'Project' }
}