StackOverflow-lite is a platform where people can ask questions and provide answers.
- Users can:
- Create an account and log in
- Can view questions
- Post questions
- Delete the questions they post
- Post answers to questions
- View answers to questions
- Update answers to questions
- Delete answers to questions
- Accept an answer out of all the answers to his/her question as they preferred answer
- Comment on an answer
- Fetch all questions he/she has ever asked on the platform
Method | Endpoint | Functionality |
---|---|---|
POST | /api/v1/auth/register |
Add a user |
POST | /api/v1/auth/login |
Login a user |
Method | Endpoint | Functionality |
---|---|---|
POST | /api/v1/questions |
Add a question |
GET | /api/v1/questions |
Lists all questions |
GET | /api/v1/questions/<question_id> |
Retrieve a question |
GET | /api/v1/questions/user_questions |
Retrieve single user questions |
DELETE | /api/v1/questions/<question_id> |
Delete a question of a logged in user |
Method | Endpoint | Functionality |
---|---|---|
POST | /api/v1/questions/<question_id>/answers |
Add answer |
GET | /api/v1/questions/<question_id>/answers/<answer_id> |
View an answer |
GET | /api/v1/questions/<question_id>/answers |
View all answers to a question |
PUT | /api/v1/questions/<question_id>/answers/<answer_id> |
Update an answer |
DELETE | /api/v1/questions/<question_id>/answers/<answer_id> |
Delete an answer |
Method | Endpoint | Functionality |
---|---|---|
POST | /api/v1/questions/<qstn_id>/answers/<ans_id>/comments |
Add a comment |
Api host
Api documentation
- Flask - Framework for Python
- Virtual environment - Tool used to create isolated python environments
- pip - Package installer for Python
-
Clone the project into your local repository using this command:
`git clone https://github.com/AnguleMathias/StackOverflow-lite_endpoints_challenge3.git`
-
Change directory to the cloned folder using the following command for Windows, Linux and MacOS
`cd StackOverflow-lite_endpoints_challenge3.git`
-
If you do not have a virtual environment installed run the following command, else follow the next steps.
`pip install virtualenv`
-
Create a virtual environment(for Windows, Linux and MacOS)
`virtualenv venv`
-
Activate the virtual environment(Windows only)
`source venv/Scripts/activate`
and for Linux and MacOS
`source venv/bin/activate`
-
Create
.env
with same variables as.env.example
then run`source .env`
-
Install the app dependencies.(for Windows, Linux and MacOS)
`pip install -r requirements.txt`
-
Run the app(for Windows, Linux and MacOS)
`python run.py`
-
Install pytest while the virtual environment is active
`pip install pytest`
-
Run the tests.
`pytest`
😉