This repository contains the backend implementation of a blogging platform. It's built using Node.js with Express.js as the web framework and MongoDB as the database. Mongoose is used for object data modeling (ODM) to manage and query the MongoDB instance.
- Node.js
- Express.js
- MongoDB
- npm or yarn (whichever package manager you prefer)
git clone <repository_url>
cd <repository_directory_name>Using npm:
npm installOr using yarn:
yarn installUsing npm:
npm startThe server will start running on the specified port or default to 5200.
-
User Registration
- Endpoint:
/api/auth/register - Method:
POST
- Endpoint:
-
User Login
- Endpoint:
/api/auth/login - Method:
POST
- Endpoint:
-
Get User Profile
- Endpoint:
/api/users/:userId/profile - Method:
GET
- Endpoint:
-
Modify User Profile
- Endpoint:
/api/users/:userId/profile - Method:
PUT
- Endpoint:
-
User's Posts
- Endpoint:
/api/users/:userId/posts - Method:
GET
- Endpoint:
-
Create Blog Post
- Endpoint:
/api/posts - Method:
POST
- Endpoint:
-
Get All Posts
- Endpoint:
/api/posts - Method:
GET
- Endpoint:
-
Get All Posts By Tags
- Endpoint:
/api/posts/byTag - Method:
GET
- Endpoint:
-
Get Single Post
- Endpoint:
/api/posts/:postId - Method:
GET
- Endpoint:
-
Modify Blog Post
- Endpoint:
/api/posts/:postId - Method:
PUT
- Endpoint:
-
Delete Blog Post
- Endpoint:
/api/posts/:postId - Method:
DELETE
- Endpoint:
- Upload Image
- Endpoint:
/api/images/upload - Method:
POST
- Endpoint:
.
|-- config
| |-- db.js
| |-- default.json
|-- controllers
| |-- auth.controller.js
| |-- images.controller.js
| |-- posts.controller.js
| |-- users.controller.js
|-- middleware
| |-- auth.js
|-- models
| |-- http-error.js
| |-- User.js
| |-- Post.js
|-- routes
| |-- api
| |-- auth.routes.js
| |-- posts.routes.js
| |-- images.routes.js
| |-- users.routes.js
|-- package.json
|-- package-lock.json
|-- server.js
|-- README.md
MIT