Skip to content

Latest commit

 

History

History
71 lines (50 loc) · 2.31 KB

README.md

File metadata and controls

71 lines (50 loc) · 2.31 KB

API Documentation

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.

Routes

Project routes
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
Task routes
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
Auth routes
HTTP verb URL Request Headers Request Body
POST /auth/signup -- { email, password, name }
POST /auth/login -- { email, password }
GET /auth/verify Authorization: Bearer < JWT > --

Models

Project Model
{
  title: String,
  description: String,
  tasks: [ { type: Schema.Types.ObjectId, ref: 'Task' } ]
}
Task Model
{
  title: String,
  description: String,
  project: { type: Schema.Types.ObjectId, ref: 'Project' }
}
User Model
{
  email: { type: String, unique: true, required: true },
  password: { type: String, required: true },
  name: { type: String, required: true },
}