Twitter Clone
Clonar repositório do projeto
git clone https://github.com/juniozguedes/django_twitter.git
pip install -r requirements.txt
python manage.py makemigrations users
python manage.py makemigrations tweets
python manage.py migrate
Na pasta frontend:
Rodando o servidor backend
Na pasta raíz:
python manage.py runserver
rota base: http://localhost:8000/
Autenticação de usuário e retorno do Token:
Method
URI
body
GET
twitter/signin
username, password
{
" username" : " jehnsen" ,
" password" : " 123456"
}
Method
URI
body
POST
twitter/signup
username, password
{
" username" : " jehnsen" ,
" password" : " 123456"
}
Method
URI
body
GET
twitter/follow
following
Tweet Routes
Show own Tweets
Method
URI
Headers
GET
api/v1
Authorization
Authorization: Token {token}
ex.: ' Token 0a46fa5cf570f194a692007d3e642bceb31b7985'
Show Tweet
Method
URI
Params
Ex.:
GET
api/v1/{{id}}
id
api/v1/3
Create Tweet
Method
URI
Body
Headers
POST
api/v1/
content
token
Authorization: Token {token}
ex.: ' Token 0a46fa5cf570f194a692007d3e642bceb31b7985'
{
" content" : " I'm tweeting! Asbaba"
}
Destroy Tweet
Method
URI
Params
Headers
Ex.:
DELETE
api/v1/{{id}}
id
token
api/v1/2
Authorization: Token {token}
ex.: ' Token 0a46fa5cf570f194a692007d3e642bceb31b7985'
Get User Tweets
Method
URI
Params
Ex.:
GET
api/v1/{{username}}/tweets
username
api/v1/jehnsen/tweets
Method
URI
Body
Headers
POST
user/follow
following
token
Authorization: Token {token}
ex.: ' Token 0a46fa5cf570f194a692007d3e642bceb31b7985'
Method
URI
Headers
GET
api/v1/timeline
token
Authorization: Token {token}
ex.: ' Token 0a46fa5cf570f194a692007d3e642bceb31b7985'
Method
URI
Params
Ex.:
GET
api/v1/{{id}}/favorites
id
api/v1/2/favorites
*Header ex:
Authorization: Token {token}
ex.: ' Token 0a46fa5cf570f194a692007d3e642bceb31b7985'
Favorite Tweet
Method
URI
Params
Headers
Ex
POST
api/v1/{{id}}/favorites
id
token
http://localhost:8000/api/v1/1/favorites
*Header ex:
Authorization: Token {token}
ex.: ' Token 0a46fa5cf570f194a692007d3e642bceb31b7985'