This repository contain backend and frontend
use
npm run dev
Parameter | Type | Description |
---|---|---|
success | boolean | the status of request |
msg | string | message for each request |
data | JSON | the actual data |
POST /login
Parameter | Type | Description |
---|---|---|
usernameOrEmail | String | username Or Email |
password | String | password |
Example
{
"usernameOrEmail" : "thistine",
"password" : "1234"
}
Response
200
login success
Parameter | Type | Description |
---|---|---|
String | user email | |
username | String | username |
id | String | user id |
Example
{
"email":"[email protected]",
"username":"thistine",
"id" : "1"
}
noted: If success, the Response will be sent with cookie named UserToken
POST /register
Parameter | Type | Description |
---|---|---|
username | String | username |
String | ||
password | String | password |
Example
{
"email":"[email protected]",
"username":"thistine",
"password" : "1234"
}
200
register success
no response body
GET /me
No Request Body
200
got data
Parameter | Type | Description |
---|---|---|
String | user email | |
username | String | username |
id | String | user id |
Example
{
"email":"[email protected]",
"username":"thistine",
"id" : "1"
}
GET /notes
No Request Body
200
found notes
Response
Parameter | Type | Description |
---|---|---|
no parameter | Array of note | all notes related to user |
the note object
Parameter | Type | Description |
---|---|---|
id | string | id of note |
title | string | note title |
description | string | note description |
updatedAt | DateTime | latest updated time |
createdAt | DateTime | create Time |
createdBy | User | note creator |
Example
[
{
"id" : "1",
"title" : "Note1",
"description" : "today is a good day",
"updatedAt" : "2023-04-25T14:58:58.264Z",
"createdAt" : "2023-04-25T14:58:58.264Z",
createdBy : {
"email":"[email protected]",
"username":"thistine",
"id" : "1"
}
}
]
get friendlist of user
GET /note/:noteId
Parameter | Type | Description |
---|---|---|
noteId | String | id of note |
No Request Body
Response
200
success
Parameter | Type | Description |
---|---|---|
id | string | id of note |
title | string | note title |
description | string | note description |
updatedAt | DateTime | latest updated time |
createdAt | DateTime | create Time |
createdBy | User | note creator |
Example
{
"id" : "1",
"title" : "Note1",
"description" : "today is a good day",
"updatedAt" : "2023-04-25T14:58:58.264Z",
"createdAt" : "2023-04-25T14:58:58.264Z",
createdBy : {
"email":"[email protected]",
"username":"thistine",
"id" : "1"
}
}
PATCH /note
Parameter | Type | Description |
---|---|---|
noteId | string | id of note |
title | string | note title |
description | string | note description |
Response
200
success
Parameter | Type | Description |
---|---|---|
id | string | id of note |
title | string | note title |
description | string | note description |
updatedAt | DateTime | latest updated time |
createdAt | DateTime | create Time |
createdBy | User | note creator |
Example
{
"id" : "1",
"title" : "Note1",
"description" : "today is a good day",
"updatedAt" : "2023-04-25T14:58:58.264Z",
"createdAt" : "2023-04-25T14:58:58.264Z",
createdBy : {
"email":"[email protected]",
"username":"thistine",
"id" : "1"
}
}
POST /note
Parameter | Type | Description |
---|---|---|
title | string | note title |
description | string | note description |
Response
200
success
Parameter | Type | Description |
---|---|---|
id | string | id of note |
title | string | note title |
description | string | note description |
updatedAt | DateTime | latest updated time |
createdAt | DateTime | create Time |
createdBy | User | note creator |
Example
{
"id" : "1",
"title" : "Note1",
"description" : "today is a good day",
"updatedAt" : "2023-04-25T14:58:58.264Z",
"createdAt" : "2023-04-25T14:58:58.264Z",
createdBy : {
"email":"[email protected]",
"username":"thistine",
"id" : "1"
}
}
DELETE /note/:noteId
Parameter | Type | Description |
---|---|---|
noteId | String | id of note |
No Request Body
Response
200
delete success
no response body
GET /comment
No Request Body
200
found comment
Response
Parameter | Type | Description |
---|---|---|
no parameter | Array of comment | all notes related to user |
the comment object
Parameter | Type | Description |
---|---|---|
id | string | id of note |
text | string | note title |
description | string | note description |
createdAt | DateTime | create Time |
createdBy | User | note creator |
Example
[
{
"id" : "1",
"text" : "comment",
"description" : "today is a good day",
"createdAt" : "2023-04-25T14:58:58.264Z",
createdBy : {
"email":"[email protected]",
"username":"thistine",
"id" : "1"
}
}
]
PATCH /comment
Parameter | Type | Description |
---|---|---|
commentId | string | id of comment |
text | string | updated text |
200
edited comment
Response
Parameter | Type | Description |
---|---|---|
id | string | id of note |
text | string | note title |
description | string | note description |
createdAt | DateTime | create Time |
createdBy | User | note creator |
Example
{
"id" : "1",
"text" : "comment",
"description" : "today is a good day",
"createdAt" : "2023-04-25T14:58:58.264Z",
createdBy : {
"email":"[email protected]",
"username":"thistine",
"id" : "1"
}
}
DELETE /comment
Parameter | Type | Description |
---|---|---|
commentId | string | id of comment |
200
deleted successfully
Response no response body