Backend for the we-project (aka. NEDian's Forum)
- Make a folder
/src/config
- Add
index.js
anddb_config.js
- Run
npm install
- Configure AWS
- Run
sls offline
to run locally. - Run
sls deploy
to deploy to AWS.
All response will be of similar structure as below:
{
"status": "[boolean]",
"result": "[result_object]",
"error": "[error_object]"
}
- The
result_object
will vary. status
will be true if request succeeds, false otherwise.error_object
will contain the error, if any.
These endpoints can be accessed by any user.
To register a user. Also logs the user in.
{
"fullname": "[full_name]",
"email": "[email_address]",
"password": "[password]"
}
To login a user
{
"email": "[email_address]",
"password": "[password]"
}
To get the user information
To get the question by question_id
To get the questions by user_id
To get answer by question_id
To get answer by user_id
To get a signed URL for uploading images to s3 bucket.
These endpoints require a valid token.
Delete the user making the request.
To update a user.
All fields are nessecary here. Pass new(updated) value in field that is to be updated. Keep the rest of the fields the same.
{
"fullname": "[full_name]",
"description": "[description]",
"image": "[image_url]"
}
To ask a new question.
Here.the question will be a string , the description will be the stringified JSON Object we get from the text editor(Slate.js) and the tags will be a stringified array of tags.
{
"question": "[question]",
"description": "[description]",
"tags": "[tags]"
}
To delete a question.
To answer a question.
Here. the questionid will be a number and the answer will be a _string
{
"question_id": "[question_id]",
"answer": "[answer]"
}
To delete an answer.
To upvote an answer.
To downvote an answer.
To update a user.
{
"new_password": "[new_password]",
"old_password": "[old_password]"
}