This project is a question-answer forum application where users can ask questions and other users can answer them. Users can also vote on questions and answers, and edit or delete their own posts. API is from the expressjs section of the Modern Web Geliştirme Kursu course. Thanks to Mustafa Murat Coşkun.
- User registration and login (JWT token-based authentication)
- Users can ask questions and answer other users' questions
- Voting system for questions and answers (like/dislike)
- Questions and answers can be edited or deleted
- Sort questions by "Most Liked" or "Most Answered"
- Pagination with limit selection
- User profile photo upload functionality
- Clone the repository:
git clone https://github.com/sametsngnn/QA-API.git
- Navigate to the API directory:
cd QA-API/API
- Install the necessary dependencies:
npm install
- Start MongoDB and create a api/config/env/config.env file:
# Server Variables
PORT=5000
NODE_ENV=development
# MongoDB Connection
MONGO_URI = mongodb+srv://...
# Json Web Token
JWT_SECRET_KEY = simpleSecretKey
JWT_EXPIRE=10m
# Cookie
JWT_COOKIE=10
# Reset Password
RESET_PASSWORD_EXPIRE=3600000
#NodeMailer
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=example@gmail.com
SMTP_PASS=examplePass
- Using Dummy Generator
- Import Dummy Data to Database from JSON Files in API/dummy Directory
npm import
- Deleting All Files in Database
npm delete
- Start the server:
npm run dev
- To start the frontend, navigate to the /client directory and follow these steps:
cd client
npm install
npm start
- Register and Login: Users can register and log into the platform.
- Ask Questions: Logged-in users can create new questions.
- Answer Questions: Users can provide answers to any question.
- Vote: Users can vote on questions and answers.
- Profile Management: Users can upload a profile picture and update their information.
- POST /api/auth/register - Register a new user
- POST /api/auth/login - Login user
- GET /api/users/:id - Get a specific user
- PUT /api/users/:id - Update user information
- GET /api/questions - Retrieve all questions
- POST /api/questions - Create a new question
- GET /api/questions/:id - Get a specific question
- PUT /api/questions/:id - Update a question
- DELETE /api/questions/:id - Delete a question
- POST /api/questions/:id/answers - Add an answer to a question
- PUT /api/questions/:id/answers/:answerId - Update an answer
- DELETE /api/questions/:id/answers/:answerId - Delete an answer
- DELETE /api/admin/user/:id - Delete user
- GET /api/admin/block/:id -Block user
- Node.js
- Express.js
- MongoDB
- JWT (JSON Web Token)
- Angular
- Bootstrap
Multer (for file uploads)