Backend is basically stored in api.js file. Here's the documentation.
URL: /signup
body
{
username: String // min: 6, max: 20
email: String // valid email
password: String // min: 6, max: your brain capacity
}
onFail:
- status code: 403, response: {invalid: REASON}
onSuccess:
- status code: 200, signs in automatically.
URL: /signin
body
{
email: String // valid email
password: String // min: 6, max: your brain capacity
}
onFail:
- status code: 404 if not found such user.
- status code: 403, response: {invalid: REASON}
onSuccess:
- status code: 200, signs in automatically.
URL: /signout
onFail:
- status code: 401 if unauthorized.
onSuccess:
- status code: 200, signs out automatically.
URL: /<USERNAME>/exits
onSuccess:
- status code: 200, resposnse json: {exists: true|false}.
URL: /
onFail:
- status code: 401 if unauthorized.
onSuccess:
- status code: 200, resposnse json: {username, email, date_of_creation, total_message}.
URL: /
onFail:
- status code: 401 if unauthorized.
onSuccess:
- status code: 200, deletes everything related to the username.
URL: /message/<PAGE>
onFail:
- status code: 401 if unauthorized.
onSuccess:
- status code: 200, resposnse json: [message...]. (message object is basically {body, username, date, _id})
[NB: Each page contains 3 messages]
URL: /toggle
onFail:
- status code: 401 if unauthorized.
onSuccess:
- status code: 200, toggles activation of account.
[NB: If account is deactivated then you will not recieve any message.]
URL: /<USERNAME>/message
body:
{
body: String // min: 1, max: 200
}
onFail:
- status code: 404 if not found such USERNAME.
- status code: 403, response: {invalid: REASON}
onSuccess:
- status code: 200, sends message to USERNAME.
[NB: For protection against spamming, messaging request limit is fixed which is 10 messages for every 15 minutes.]