Giter Site home page Giter Site logo

chirpy's Introduction

Chirpy

Chirpy is twitter-like clone API for sending short messages. This is a guided project is a part of boot.dev program.

API resources

User

Create User

POST /api/users

{
    "email": "[email protected]",
    "password": "123456"     

}

RESPONSE

{
    "email": "[email protected]",
    "id": 1,
    "token": "this_is_jwt_token"
}

Update User

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"
}

Login User

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"
}

Tokens

Refresh Token

POST /api/refresh

{
    "Authorization": "Bearer this_is_refresh_jwt_token"
}

RESPONSE

{
    "token": "this_is_a_new_access_jwt_token"
}

Revoke Token

POST /api/revoke

{
    "refresh_token": "this_is_refresh_jwt_token"
}

Chirps (messages)

Post a Chirp

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 chirps

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 a singel chirp

GET /api/chirps/{chirpID}

RESPONSE

{
    "id": 1,
    "body": "Write your message here!",
    "author_id": 1
}

Delete a Chirp

POST /api/chirps/{chirpID}

Header:

{
    "Authorization": "Bearer this_is_access_token"
}

chirpy's People

Contributors

kwintti avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.