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 |
GET | /api/tasks/:taskId |
(empty) | Returns the specified task |
PUT | /api/tasks/:taskId |
JSON | Edits the specified task |
DELETE | /api/tasks/:taskId |
(empty) | Deletes the specified task |
HTTP verb | URL | Request Headers | Request Body |
---|---|---|---|
POST | /auth/signup |
-- | { email, password, name } |
POST | /auth/login |
-- | { email, password } |
GET | /auth/verify |
Authorization: Bearer < JWT > | -- |
{
title: String,
description: String,
tasks: [ { type: Schema.Types.ObjectId, ref: 'Task' } ]
}
{
title: String,
description: String,
project: { type: Schema.Types.ObjectId, ref: 'Project' }
}
{
email: { type: String, unique: true, required: true },
password: { type: String, required: true },
name: { type: String, required: true },
}