Chirpy is twitter-like clone API for sending short messages. This is a guided project is a part of boot.dev program.
POST /api/users
{
"email": "[email protected]",
"password": "123456"
}
RESPONSE
{
"email": "[email protected]",
"id": 1,
"token": "this_is_jwt_token"
}
PUT /api/users
Header:
{
"Authorization": "Bearer this_is_jwt_token"
}
Body:
{
"email": "[email protected]",
"id": 1
}
RESPONSE
{
"email": "[email protected]",
"id": 1,
"token": "this_is_jwt_token"
}
PUT /api/login
{
"email": "[email protected]",
"password": "123456"
}
RESPONSE
{
"email": "[email protected]",
"id": 1,
"token": "this_is_access_jwt_token",
"refresh_token": "this_is_refresh_jwt_token"
}
POST /api/refresh
{
"Authorization": "Bearer this_is_refresh_jwt_token"
}
RESPONSE
{
"token": "this_is_a_new_access_jwt_token"
}
POST /api/revoke
{
"refresh_token": "this_is_refresh_jwt_token"
}
POST /api/chirps
Header:
{
"Authorization": "Bearer this_is_access_token"
}
Body:
{
"body": "Write your message here!"
}
RESPONSE
{
"id": 1,
"body": "Write your message here!",
"author_id": 1
}
GET /api/chirps
Available parameters:
author_id: lists chirps from this user sort: sorts chirps in ascending(asc or defauld) or descending(desc) order
Usage: Add to the end of url of api call: /api/chirps?author_id=1&sort=desc
RESPONSE
[
{
"id": 1,
"body": "Write your message here!",
"author_id": 1
},
{
"id": 2,
"body": "Second message!",
"author_id": 1
},
]
GET /api/chirps/{chirpID}
RESPONSE
{
"id": 1,
"body": "Write your message here!",
"author_id": 1
}
POST /api/chirps/{chirpID}
Header:
{
"Authorization": "Bearer this_is_access_token"
}