POST baseurl /auth/login to get a token, to authorize some further access of API
POST baseurl /auth/register to register a credential, to access the api later
POST baseurl /auth/google-login to generate api token, using google oAuth2 token
GET baseurl /article-home to get articles shown at home page
GET baseurl /article/:id to get an article
POST baseurl /article to create an article, require api token
PATCH baseurl /article/:id to update an article, require api token
DELETE baseurl /article/:id to delete an article, require api token
Method: POST
URL: /auth/register
Request Body:
{
name: String,
email: String,
password: String
}
Response Success
Status: 201
Body:
{
_id: String //mongoose schema id,
name: String,
email: String
}
Response Failure
Status: 500
Body:
{
message: "Internal Server Error";
}
Method: POST
URL: /auth/login
Request Body:
{
email: String,
password: String
}
Response Success
Status: 201
Body:
{
user: {
_id: String,
name: String,
email: String
},
token: String
}
Response Failure
Status: 500
Body:
{
message: "Internal Server Error";
}
method POST url /article header
{
token: mini - wp - api_token;
}
response success status 201 body
{ author: String, title:String, content:String, created_at:Date, featured_image: String, tags:[String] }
response fails status 500 body
{ msg:'internal server error' }
method POST url /article/:id header
{
token: mini - wp - api_token;
}
response success status 204 body
{ author: String, title:String, content:String, created_at:Date, featured_image: String, tags:[String] }
response fails status 500 body
{ msg:'internal server error' }
method POST url /article header
{
token: mini - wp - api_token;
}
response success status 201 body
{ author: String, title:String, content:String, created_at:Date, featured_image: String, tags:[String] }
response fails status 500 body
{ msg:'internal server error' }
method POST url /article header
{
token: mini - wp - api_token;
}
response success status 201 body
{ author: String, title:String, content:String, created_at:Date, featured_image: String, tags:[String] }
response fails status 500 body
{ msg:'internal server error' }
method POST url /article header
{
token: mini - wp - api_token;
}
response success status 201 body
{ author: String, title:String, content:String, created_at:Date, featured_image: String, tags:[String] }
response fails status 500 body
{ msg:'internal server error' }