Skip to content

Files

Latest commit

May 25, 2024
19c0a2f · May 25, 2024

History

History
164 lines (158 loc) · 1.93 KB

api_docs.md

File metadata and controls

164 lines (158 loc) · 1.93 KB

Model

User

{
    "_id":ObjectId(),
    "email":string,
    "name":string,
    "password":string,
    "createdAt":DateTime
}

Content

{
    "_id":ObjectId(),
    "author":string,
    "authorId":ObjectId(),
    "content":{
        "title":string,
        "content":string
    },
    "tags":Array(string),
    "createdAt":Datetime,
    "updatedAt":Datetime,
}

API

/api/register

POST:

Request

{
    "email":string,
    "name":string,
    "password":string,
}

Response

{
    "message":"user registration success"
}

/api/login

POST:

Request

{
    "email"|"username":string,
    "password":string
}

Response:

cookies
{
    Authorization:token
}

/api/content

GET:

Response

10 *
{
    "_id":ObjectId(),
    "author":string,
    "authorId":ObjectId(),
    "content":{
        "title":string,
        "content":string
    },
    "tags":Array(string),
    "createdAt":Datetime,
    "updatedAt":Datetime,
}

POST:

Request

{
    "title":string,
    "content":string
}

Response

{
    "message":"Successfully created"
}

/api/cms

GET:

Response

   [,
   ...
    {
    "_id":ObjectId(),
    "author":"",
    "authorId":ObjectId(),
    "content":{
        "title":"",
        "content":""
    },
    "tags":[],
    "createdAt":"",
    "updatedAt":"",
    },
    ...
   ]

POST:

Request

{
    "author":"",
    "authorId":ObjectId(),
    "content":{
        "title":"",
        "content":""
    },
    "tags":[],
}

Response

{
    "message":"Content was successfully created"
}

/api/cms/:id

PUT:

Request

{
    "author":"",
    "authorId":ObjectId(),
    "content":{
        "title":"",
        "content":""
    },
    "tags":[],
}

Response

{
    "message":"Content was successfully updated"
}

DELETE:

Response

{
    "message":"Content was successfully updated"
}