Welcome to our StackOverflow clone, created by the Boolean Bullies team. Checkout our live site by clicking StackOverflow_clone.
For this project, we used the following technologies:
- Docker
- Backend
- Python
- Flask
- WTForms
- SQLAlchemy
- Alembic
- SQLite3 (development)
- PostgreSQL (production)
- Frontend
- Javascript
- React
- React-Router
- React-Redux
- CSS
- Clone the repo and run
pipenv installto install the dependencies - Create .env file, for example:
SECRET_KEY=[add secret key here] DATABASE_URL=sqlite:///dev.db - Start pipenv shell
pipenv shell - Migrate and seed database
flask db migrateandflask seed all - Run flask
flask run - cd into the
react-app - run
npm installto install the frontend dependencies - run
npm startto start the frontend - go to localhost:3000 in your browser
- Signup
- Login
- Demo user with full functionality
- View all Questions
- View only your Questions and your Answers
- Answer any Question you didn't ask
- Vote on any Answer
- Comment on Any Answer
- Update or Delete only a Question that you asked
- Update or Delete only an Answer you posted
- Delete any comment you made
- Clear your vote and re-vote
- Search bar to search questions
- Add categories for questions based on topics
Prepend all routes below with /api
POST credentials for authentication
POST create new user
DELETE user session
GET my questions
Require Authentication: TRUE
Request Body: N/A
Response Body Status Code: 200
Require Authentication: TRUE
{
"Questions" :
[
{
"id": 1,
"userId": 1,
"username": "demo",
"title": "Sample Title",
"body": "Sample Body",
"created_on": "2022-12-12",
"last_update_on": "2022-12-12"
},
{
"id": 2,
"userId": 1,
"username": "demo",
"title": "Sample Title",
"body": "Sample Body",
"created_on": "2022-12-12",
"last_update_on": "2022-12-12"
}
]
}
GET my answers
Require Authentication: TRUE
Request Body: N/A
Response Body
Status Code: 200
Require Authentication: TRUE
{
"Answers" :
[
{
"id": 1,
"userId": 1,
"username": "demo",
"questionId":1,
"body": "Sample Body",
"created_on": "2022-12-12",
"last_update_on": "2022-12-12"
},
{
"id": 2,
"userId": 1,
"username": "demo",
"questionId":1,
"body": "Sample Body",
"created_on": "2022-12-12",
"last_update_on": "2022-12-12"
}
]
}
GET all questions
Require Authentication: TRUE
Request Body: N/A
Response Body
Status Code: 200
{
"Questions" :
[
{
"id": 1,
"userId": 1,
"username": "demo",
"title": "Sample Title",
"body": "Sample Body",
"created_on": "2022-12-12",
"last_update_on": "2022-12-12"
},
{
"id": 2,
"userId": 2,
"username": "demo",
"title": "Sample Title",
"body": "Sample Body",
"created_on": "2022-12-12",
"last_update_on": "2022-12-12"
}
]
}
POST a new question
Require Authentication: TRUE
Request Body
{
"title": "Sample Title",
"body": "Sample Body"
}
Response Body
Status Code: 201
{
"id": 2,
"userId": 2,
"username": "demo",
"title": "Sample Title",
"body": "Sample Body",
"created_on": "2022-12-12",
"last_update_on": "2022-12-12"
}
GET a specific question and it's associated answers, cumulative votes, and comments
Require Authentication: TRUE
Response Body
Status Code: 200
{
"Question" :
{
"id": 1,
"userId": 1,
"username": "demo",
"title": "Sample Title",
"body": "Sample Body",
"created_on": "2022-12-12",
"last_update_on": "2022-12-12",
"Answers" :
[
{
"id": 1,
"userId": 1,
"username": "demo",
"questionId":1,
"body": "Sample Body",
"created_on": "2022-12-12",
"last_update_on": "2022-12-12",
"Comments":
[
{
"id": 1,
"userId": 1,
"username": "demo",
"answerId": 1,
"body": "Sample Body"
},
{
"id": 2,
"userId": "1",
"username": "demo",
"answerId": "1",
"body": "Sample Body"
}
],
"Votes":
{
"hasVoted" : false,
"total" : -1,
"voteId" : Null
}
}
]
}
}
PUT to update a specific question
Require Authentication: TRUE
Request Body
{
"title": "Sample Title",
"body": "Sample Body"
}
Response Body
Status Code: 200
Require Authentication: TRUE
{
"id": 2,
"userId": 2,
"username": "demo",
"title": "Sample Title",
"body": "Sample Body",
"created_on": "2022-12-12",
"last_update_on": "2022-12-12"
}
DELETE a specific question
Require Authentication: TRUE
Request Body: N/A
Response Body
Status Code: 200
{
"message": "Successfully deleted",
"Status Code": 200
}
POST a new answer
Require Authentication: TRUE
Request Body
{
"body": "Sample Body"
}
Response Body
Status Code: 201
{
"id": 2,
"userId": 2,
"username": "demo",
"questionId": 1,
"body": "Sample Body",
"created_on": "2022-12-12",
"last_update_on": "2022-12-12"
}
PUT to update a specific answer
Require Authentication: TRUE
Request Body
{
"body": "Sample Body"
}
Response Body
Status Code: 200
{
"id": 2,
"userId": 2,
"username": "demo",
"questionId": 1,
"body": "Sample Body",
"created_on": "2022-12-12",
"last_update_on": "2022-12-12"
}
DELETE a specific answer
Require Authentication: TRUE
Request Body N/A
Response Body
Status Code: 200
{
"message": "Delete Successfully",
"Status Code": 200
}
POST a new comment
Require Authentication: TRUE
Request Body
{
"body": "Sample Body"
}
Response Body
Status Code: 200
{
"id": 2,
"userId": 2,
"username": "demo",
"answerId": 1,
"body": "Sample Body",
"created_on": "2022-12-12",
"last_update_on": "2022-12-12"
}
PUT to update a specific comment
Require Authentication: TRUE
Request Body
{
"body": "Sample Body"
}
Response Body
Status Code: 200
{
"id": 2,
"userId": 2,
"username": "demo",
"answerId": 1,
"body": "Sample Body",
"created_on": "2022-12-12",
"last_update_on": "2022-12-12"
}
DELETE a specific comment
Require Authentication: TRUE
Request Body N/A
Response Body Status Code: 200
{
"message": "Delete Successfully",
"Status Code": 200
}
POST a vote direction for a specific user on a specific answer
Require Authentication: TRUE
Request Body
{
"voteDirection": 'Up'
}
Response Body
Status Code: 200
{
"id": 2,
"userId": 2,
"answerId": 1,
"voteDirection": "Down"
}
DELETE a specific vote
Require Authentication: TRUE
Request Body: N/A
Response Body
Status Code: 200
{
"message": "Successfully deleted",
"Status Code": 200
}


