https://github.com/alotab/simple-node-blog-backend
https://github.com/alotab/simple-node-blog-backend
authentication javascript jwt-authentication nodejs
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/alotab/simple-node-blog-backend
- Owner: Alotab
- Created: 2025-01-06T18:09:19.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-12T21:08:45.000Z (over 1 year ago)
- Last Synced: 2025-08-07T18:35:29.547Z (11 months ago)
- Topics: authentication, javascript, jwt-authentication, nodejs
- Language: JavaScript
- Homepage:
- Size: 3.28 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Simple Node Blog Backend
This project is a backend application built with Node.js, Express, and MongoDB. It allows users to register, authenticate, and perform CRUD operations on blogs. The system uses JWT (JSON Web Tokens) for user authentication and authorization.
## Features
- User Authentication & Authorization:
- User registration with secure password hashing.
- User login to generate JWT token.
- Middleware to verify user’s token for secured routes.
- Blog Management:
- CRUD (Create, Read, Update, Delete) operations for blog posts.
- Only the author of the blog can edit or delete their blog.
- Database:
- MongoDB is used for storing Users and Blog data.
## Installation
1. Clone the repository:
```
git clone https://github.com/Alotab/simple-node-blog-backend.git
cd simple-node-blog-backend
```
2. Install dependencies:
```
npm install
```
3. Set up environment variables:
Create a .env file in the root of your project with the following configuration:
```
PORT=3000
MONGO_DB_URL=mongodb+srv://your-db-username:your-password@cluster0.hxlnp.mongodb.net/
JWT_SECRET_KEY=JWT_SECRET_KEY
```
4. Run the application:
```
npm run dev
```
The application will run on http://localhost:3000 (or the port defined in the .env file).