Welcome to the backend of the Content Sharing Platform project. This backend is built using Express.js and utilizes various packages to provide functionality such as authentication, database operations, and more.
Follow these instructions to set up and run the backend Express app on your local machine.
Node.js (v14 or higher) npm (Node Package Manager)
- git clone https://github.com/veeru78866/content-sharing-platform-app.git
- Navigate to the project directory. --> cd content-sharing-platform-backend
- Install the required packages using npm.--> npm install
nodemon index.js
GET http://localhost:3500/user-details
Authorization: Bearer JWT_TOKEN
{
"id": 2,
"username": "veerendra45",
"gender": "Male",
"location": "hyderabad",
"mobile_number": "9898980001"
}
POST http://localhost:3500/users/ <br/>
Content-Type: application/json <br/>
{
"username":"ramana",
"password": "2023",
"gender": "Male",
"location":"hyderabad",
"mobile_number": "9898980004"
}
{
"success_msg": "User created successfully"
}
{
"error_msg": "User already exists"
}
POST http://localhost:3500/login/
Content-Type: application/json
{ "username":"veerendra45", "password": "2023" }
{
"jwtToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InZlZXJlbmRyYTQ1IiwiaWF0IjoxNjkyMDM2ODQzfQ.p1LjzEAWp_zK6nwdDJCRSzCIfWQb0evcu87YLjx6UwQ"
}
POST http://localhost:3500/post/
Authorization: Bearer JWT_TOKEN
Content-Type: application/json
{ "post" : "I LOve My India" }
GET http://localhost:3500/post?search_q=
Authorization: Bearer JWT_TOKEN
[
{
"post_id": 15,
"post": "Happy Independence Day in Advance",
"username": "veerendra45",
"date_time": "2023-08-14 19:28:23",
"likes_count": 2,
"replies": null,
"like_status": 1
},
{
"post_id": 3,
"post": "Happy Independence Day",
"username": "veerendra45",
"date_time": "2023-08-12 11:09:09",
"likes_count": 4,
"replies": [
{
"reply_id": 2,
"reply": "Jai Hind!!!",
"replied_by": "veerendra45",
"reply_date_time": "2023-08-13 11:33:53"
},
{
"reply_id": 3,
"reply": "Jai Hind!!!",
"replied_by": "veerendra45",
"reply_date_time": "2023-08-13 11:34:22"
},
{
"reply_id": 2,
"reply": "Jai Hind!!!",
"replied_by": "veerendra45",
"reply_date_time": "2023-08-13 11:33:53"
},
{
"reply_id": 3,
"reply": "Jai Hind!!!",
"replied_by": "veerendra45",
"reply_date_time": "2023-08-13 11:34:22"
}
],
"like_status": 1
},
...
]
PUT http://localhost:3500/post/6/
Authorization: Bearer JWT_TOKEN
Content-Type: application/json
{ "post" : "I LOve My India" }
DELETE http://localhost:3500/post/6/
Authorization: Bearer
POST http://localhost:3500/like-post/
Authorization: Bearer JWT_TOKEN
Content-Type: application/json
{ "postId" : 12 }
DELETE http://localhost:3500/like-post/10/
Authorization: Bearer JWT_TOKEN
POST http://localhost:3500/reply/
Authorization: Bearer
Content-Type: application/json
{ "postId" : 3, "reply" : "Jai Hind!!!" }