This project is a StackOverflow clone with basic features, including user authentication, question creation, answering, image uploading, and voting. The frontend is developed using Angular, and the backend is built with Spring Boot. JWT is used for security.
- Node.js and npm (for Angular)
- Java 8 or higher
- Maven
- MySQL database
-
Navigate to the
frontend
directory:cd frontend
-
Install dependencies:
npm install
-
Run the development server:
ng serve
The app will be accessible at
http://localhost:4200/
.
-
Navigate to the
backend
directory:cd backend
-
Set up your MySQL database and update the
application.properties
file with the database configuration. -
Build the project:
mvn clean install
-
Run the Spring Boot application:
java -jar target/stackoverflow-clone.jar
The backend will be accessible at
http://localhost:8080/
.
POST /signup
- Register a new user.POST /auth
- Login and obtain JWT token.
POST /api/question
- Create a new question (requires authentication).GET /api/questions/{pageNumber}
- Get all questions with pagination.GET /api/question/{userId}/{questionId}
- Get a question by ID with answers.GET /api/questions/{userId}/{pageNumber}
- Get questions by user ID.POST /api/vote
- Add vote to a question (requires authentication).
POST /api/answer
- Create a new answer for a question (requires authentication).
POST /api/image/upload
- Upload an image into the database (requires authentication).
- Make sure to configure your MySQL database and update the application.properties file accordingly.
- Ensure that the frontend and backend are running simultaneously for the full application experience.
Feel free to customize and extend the functionality based on your project requirements.