Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/deepashrisg/blogapp
This is the backend of a Blog Application built using Node.js and Express. It includes features for user authentication, file uploads, and interaction with a MongoDB database.
https://github.com/deepashrisg/blogapp
express mongodb mongoose nodejs
Last synced: 12 days ago
JSON representation
This is the backend of a Blog Application built using Node.js and Express. It includes features for user authentication, file uploads, and interaction with a MongoDB database.
- Host: GitHub
- URL: https://github.com/deepashrisg/blogapp
- Owner: DeepaShriSG
- Created: 2024-12-14T18:31:29.000Z (12 days ago)
- Default Branch: main
- Last Pushed: 2024-12-14T18:41:41.000Z (12 days ago)
- Last Synced: 2024-12-14T19:33:42.335Z (12 days ago)
- Topics: express, mongodb, mongoose, nodejs
- Language: JavaScript
- Homepage: https://blogapp-im1g.onrender.com
- Size: 27.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Postman Link: https://planetary-crescent-492103.postman.co/workspace/Tasks~cfafac11-0028-4d75-bfd8-96da8b6fe325/collection/30449018-f45d1640-ed4a-4ea7-b9f9-c476e1a76b2d?action=share&creator=30449018&active-environment=30449018-d7dac20a-fcdc-4dd0-8c83-fe2aff5621ed
https://blogapp-im1g.onrender.com
# Blog App BackendThis is the backend of a Blog Application built using Node.js and Express. It includes features for user authentication, file uploads, and interaction with a MongoDB database.
## Features
- User authentication with JSON Web Tokens (JWT).
- Secure password hashing with bcryptjs.
- Cloudinary integration for image storage.
- File upload handling using Multer and Multer Cloudinary Storage.
- RESTful API structure.## Prerequisites
- [Node.js](https://nodejs.org/) (v16 or later recommended)
- [MongoDB](https://www.mongodb.com/) database
- Cloudinary account for image hosting## Installation
1. Clone the repository:
```bash
git clone
```
2. Navigate to the project directory:
```bash
cd blogapp
```
3. Install dependencies:
```bash
npm install
```
4. Create a `.env` file in the root directory and add the following environment variables:
```env
PORT=5000
MONGO_URI=
JWT_SECRET=
CLOUDINARY_CLOUD_NAME=
CLOUDINARY_API_KEY=
CLOUDINARY_API_SECRET=
```## Usage
1. Start the server:
```bash
npm start
```Nodemon will automatically restart the server on file changes.
2. The API will run at `http://localhost:5000` by default.
## Scripts
- `npm start`: Start the server with Nodemon.
- `npm test`: Run tests (if implemented).## Dependencies
- **bcryptjs**: For password hashing.
- **cloudinary**: For storing images in the cloud.
- **cors**: To handle Cross-Origin Resource Sharing.
- **dotenv**: For managing environment variables.
- **express**: For creating the server and routing.
- **jsonwebtoken**: For user authentication.
- **mongoose**: For interacting with MongoDB.
- **multer**: For file uploads.
- **multer-storage-cloudinary**: For integrating Multer with Cloudinary.
- **nodemon**: For automatic server restarts during development.## API Endpoints
### Authentication
- `POST /api/auth/register`: Register a new user.
- `POST /api/auth/login`: Log in a user.### Blog Posts
- `GET /api/posts`: Get all blog posts.
- `POST /api/posts`: Create a new blog post (authenticated).
- `GET /api/posts/:id`: Get a specific blog post by ID.
- `PUT /api/posts/:id`: Update a blog post (authenticated).
- `DELETE /api/posts/:id`: Delete a blog post (authenticated).### File Uploads
- `POST /api/uploads`: Upload an image file.
## Routes Configuration
```javascript
router.use("/user", UserRoutes);
router.use("/posts", PostsRoutes);
router.use("/likes", likeRoutes);
router.use("/comment", commentRoutes);
```## Contributing
Contributions are welcome! Feel free to open issues or submit pull requests.
## Author
Your Name
##DeepaShriSGHappy coding!