A robust RESTful API backend for a blog website built with Node.js, Express.js, and MongoDB as part of a full MERN stack application.
- RESTful API - Clean and organized API endpoints
- JWT Authentication - Secure user authentication
- MongoDB Integration - NoSQL database with Mongoose ODM
- File Upload - Image upload functionality with Multer
- Password Hashing - Secure password storage with bcryptjs
- CORS Enabled - Cross-origin resource sharing
- Error Handling - Comprehensive error handling middleware
- Node.js
- Express.js
- MongoDB
- Mongoose
- JWT (JSON Web Tokens)
- bcryptjs
- Multer
- CORS
- dotenv
- Clone the repository:
git clone https://github.com/asheint/mern-stack-blog-website-backend.git
cd mern-stack-blog-website-backend- Install dependencies:
npm install- Create a
.envfile in the root directory:
MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret_key
PORT=5000- Start the development server:
npm run devThe server will run on http://localhost:5000
POST /api/users/register- Register new userPOST /api/users/login- User loginGET /api/users/profile- Get user profile
GET /api/posts- Get all postsPOST /api/posts- Create new postGET /api/posts/:id- Get single postPUT /api/posts/:id- Update postDELETE /api/posts/:id- Delete post
This backend works with the MERN Stack Blog Website Frontend: https://github.com/asheint/mern-stack-blog-website
Contributions, issues, and feature requests are welcome!
If this project helped you, please consider:
- Giving it a ⭐ on GitHub
- Supporting me on Buy Me a Coffee ☕
This project is licensed under the MIT License.
Star this repo if it helped you! ⭐