Blog_API_doc
Blog_API_doc
Contents
1. Project Overview
2. Tech Stack
3. Features
4. Installation
5. Environment Variables
6. API Endpoints
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=
-
6. API Endpoints
**Auth Routes:**
POST /api/v1/auth/signup - Register a new user (email, password, pro ile picture)
**Blog Routes:**
8. Folder Structure
- `controllers/` - Route handlers
- `middlewares/` - Middleware functions
- `routes/` - Express routes
- `prisma/` - Prisma schema and migrations
- `uploads/` - Uploaded images
- `utils/` - Utility functions