0% found this document useful (0 votes)
3 views

Blog_API_doc

This document provides a README for a Node.js-based blog API that includes user authentication and CRUD operations for blog posts. It outlines the tech stack, features, installation instructions, environment variables, API endpoints, and folder structure. The API supports user registration, login, and management of blog content with JWT-based authentication.

Uploaded by

Anand Kushwaha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Blog_API_doc

This document provides a README for a Node.js-based blog API that includes user authentication and CRUD operations for blog posts. It outlines the tech stack, features, installation instructions, environment variables, API endpoints, and folder structure. The API supports user registration, login, and management of blog content with JWT-based authentication.

Uploaded by

Anand Kushwaha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Blog API with Authen ca on and CRUD - README

Contents
1. Project Overview

2. Tech Stack

3. Features

4. Installation

5. Environment Variables

6. API Endpoints

7. Running the Server

8. Folder Structure

1. Project Overview
This is a Node.js-based backend project that provides APIs for a blog platform. It supports
user authentication (signup/login) and CRUD operations for blog posts.

2. Tech Stack
- Node.js
- Express.js
- PostgreSQL
- Prisma ORM
- Multer for ile uploads

3. Features
- User Signup (email, password, pro ile picture)
- User Login (email, password)
- Create, Read, Update, Delete (CRUD) for blog posts
- Blog post includes title, description, and image
- JWT-based authentication

4. Installa on
1. Clone the repository
2. Run `npm install` to install dependencies
3. Set up the `.env` ile with appropriate environment variables
4. Run Prisma migrations using `npx prisma migrate dev`
ti
f
f
ti
ti
f
5. Environment Variables
- `DATABASE_URL`: PostgreSQL connection string
- `JWT_SECRET`: Secret key for JWT token
- `PORT`: Port to run the server (default: 3000)

- CLOUDINARY_CLOUD_NAME=‘’

- CLOUDINARY_API_KEY=

- CLOUDINARY_API_SECRET=

- VITE_BASE_URL= this for frontend

-
6. API Endpoints
**Auth Routes:**

POST /api/v1/auth/signup - Register a new user (email, password, pro ile picture)

POST /api/v1/auth/login - Login a user (email, password)

GET /api/v1/pro ile - user pro ile

**Blog Routes:**

POST /api/v1/blog/create - Create a new blog (Authenticated)

GET /api/v1/blogs - Get all blogs

GET /api/v1/blogs/:id - Get a single blog by ID

PUT /api/v1/blogs/:id - Update blog (Authenticated & Owner Only)

DELETE /api/v1/blogs/:id - Delete blog (Authenticated & Owner Only)

7. Running the Server


Use `npm run start` to start the server in development mode.

8. Folder Structure
- `controllers/` - Route handlers
- `middlewares/` - Middleware functions
- `routes/` - Express routes
- `prisma/` - Prisma schema and migrations
- `uploads/` - Uploaded images
- `utils/` - Utility functions

9. Git hub links

For backend:- “https://github.com/ANandasaad/VegaBackend"


f
f
f
For frontend:-“https://github.com/ANandasaad/VegaFronten"

You might also like