Doc

About

This is a backend for a simple social media application. It is created using django as the backend framework and MongoDB as the database provider.

End points

  • /api/create: This endpoint creates an account using the username and password provided as its request.

Request

{
	"username": "GhoulRe",
	"password": "1234"
}

Response

{
    "return": "created"
}

or

{
    "return": "invalid"
}

or

{
    "return": "already exists"
}
  • /api/login: This is used to handle logging in

Request

{
	"username": "GhoulRe",
	"password": "1234"
}

Response

{
    "return": "correct"
}

or

{
    "return": "invalid"
}

The text for the second login return case is kept as "invalid" for consistency

  • /api/chats: This is used to handle logging in

Request

{
	"users": ["GhoulRe", "GhoulKing"]
}

Response

[
    {"from": "GhoulRe", "text": "Hello"}
    {"from": "GhoulKing", "text": "Hi"}
]

or

[]
  • /api/send: This is used to handle logging in

Request

{
	"users": ["GhoulRe", "GhoulKing"],
    "message": {
        "from": "GhoulRe",
        "message": "How you doing?"
    }
}

Response

{
    "from": "GhoulRe",
    "message": "How you doing?"
}