Skip to content

pushpitkamboj/blog-website

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 

Repository files navigation

Blog App Backend

Overview

This is the backend for the Blog App. It is a Node.js application that uses the Prisma ORM to interact with the database.

Quick Start

Using Docker (recommended)

Manual Setup

  1. Clone the repository
git clone https://github.com/yourusername/blog-app-backend.git
cd blog-app-backend
  1. Install dependencies
npm install
  1. generate Prisma client
npx prisma generate
  1. create a .env file and add the following variables:
DATABASE_URL="your-database-url"
SECRET_KEY="your-secret-key"
  1. Start the application
npm run dev
  1. Open the browser and navigate to http://localhost:8787

API Documentation

The API documentation is available in the docs folder.

📚 API Endpoints

Authentication

Method Endpoint Description Auth Required
POST /api/v1/user/register Register new user No
POST /api/v1/user/login Login user No

User Management

Method Endpoint Description Auth Required
GET /api/v1/user/profile Get user profile Yes
PUT /api/v1/user/profile Update profile Yes
PUT /api/v1/user/password Change password Yes
DELETE /api/v1/user/account Delete account Yes

Blog Posts

Method Endpoint Description Auth Required
GET /api/v1/blog/posts List all posts No
GET /api/v1/blog/posts/:id Get single post Yes
GET /api/v1/blog/posts/search Search posts Yes
GET /api/v1/blog/posts/author/:authorId Get author's posts Yes

Writer Operations

Method Endpoint Description Auth Required
POST /api/v1/writers/posts Create post Yes
PUT /api/v1/writers/posts/:id Update post Yes
DELETE /api/v1/writers/posts/:id Delete post Yes
PATCH /api/v1/writers/posts/:id/publish Toggle publish status Yes
GET /api/v1/writers/drafts Get draft posts Yes

Comments

Method Endpoint Description Auth Required
POST /api/v1/blog/posts/:id/comments Add comment Yes
DELETE /api/v1/blog/comments/:id Delete own comment Yes
DELETE /api/v1/writers/posts/:postId/comments/:commentId Delete any comment (writer only) Yes
PATCH /api/v1/writers/posts/:id/comments-status Toggle comments Yes

here is the live link of website : https://backend.pushpitkamboj.workers.dev/

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published