Welcome to the backend repository for our blog website! This repository contains the server-side code built using Node.js to support the functionality of our blog application.
- Node.js: Used to create the backend server and handle API requests.
- Express.js: Used as the web framework to simplify routing and middleware creation.
- MongoDB: Used as the database to store blog posts, comments, and user information.
- Mongoose: Used as an Object Data Modeling (ODM) library for MongoDB to simplify interactions with the database.
- Postman: Used for API testing and development.
- React (Frontend): Although this repository focuses on the backend, it's worth mentioning that our blog website's frontend is built using React.js.
- Clone the repository:
- Install dependencies: cd blog-backend npm install
- Set up MongoDB:
- Create a MongoDB database and configure the connection string in a
.envfile.
- Run the server:npm start
- Use Postman to test API endpoints:
- Import the Postman collection provided in the
postman_collection.jsonfile. - Test endpoints for creating, updating, deleting blog posts, managing comments, and user authentication.
- GET
/posts: Get all blog posts. - GET
/posts/:id: Get a specific blog post by ID. - POST
/posts: Create a new blog post. - PUT
/posts/:id: Update an existing blog post. - DELETE
/posts/:id: Delete a blog post by ID. - POST
/comments: Add a comment to a blog post. - DELETE
/comments/:id: Delete a comment by ID. - POST
/login: User login endpoint. - POST
/register: User registration endpoint.
- Fork the repository.
- Create your feature branch (
git checkout -b feature/new-feature). - Commit your changes (
git commit -m 'Add new feature'). - Push to the branch (
git push origin feature/new-feature). - Open a Pull Request.
For any questions or feedback, please contact us at merugu.adithya.29@gmail.com.