Questionify is a web application where users can sign up, sign in, post questions, view other users' questions, and comment on them. The application is built using Node.js, Express.js, and MongoDB, with EJS as the templating engine and JWT for authentication.
- User registration and authentication using JWT
- Secure login and logout functionality
- Ability to post questions
- View all questions posted by users
- Comment on questions
- Node.js
- Express.js
- MongoDB
- Mongoose
- EJS (Embedded JavaScript templates)
- JWT (JSON Web Tokens)
- Multer (for file uploads)
-
Clone the repository:
git clone https://github.com/your-username/questionify.git
-
Navigate to the project directory:
cd questionify -
Install the dependencies:
npm install
-
Set up environment variables: Create a
.envfile in the root directory and add the following environment variables:PORT=3000 MONGODB_URI=your_mongodb_uri JWT_SECRET=your_jwt_secret
-
Start the server:
npm start
-
Open your browser and navigate to
http://localhost:3000.
POST /signup- Register a new userPOST /signin- Sign in an existing userGET /logout- Log out the current user
GET /questions- View all questionsPOST /questions- Post a new question (authenticated users only)GET /questions/:id- View a specific questionPOST /questions/:id/comments- Comment on a specific question (authenticated users only)