From dc4baabe391726e02830bd8055ce0b6a2139c109 Mon Sep 17 00:00:00 2001 From: Kshitij <160704796+kshitij-ka@users.noreply.github.com> Date: Fri, 4 Jul 2025 01:43:34 +0530 Subject: [PATCH] Added CURL commands to test basic backend functionality such as login, register, file upload + download. --- 1.2-BACKEND-APIs.md | 48 +++++++++++++++++++++++++++++++++++++++++++++ Home.md | 1 + 2 files changed, 49 insertions(+) create mode 100644 1.2-BACKEND-APIs.md diff --git a/1.2-BACKEND-APIs.md b/1.2-BACKEND-APIs.md new file mode 100644 index 0000000..72af4e2 --- /dev/null +++ b/1.2-BACKEND-APIs.md @@ -0,0 +1,48 @@ +# BACKEND-APIs + +--- + +> [!TIP] +> `-k` in CURL allows for self-signed certificates. + +## Register + +```shell +curl -k -X POST https://localhost:8080/api/auth/register -H "Content-Type: application/json" -d '{ + "email": "testHDFS@example.com", + "password": "Pass@123", + "username": "testHDFS3", + "firstname": "Test", + "lastname": "HDFS", + "fullname": "Test HDFS" +}' +``` + +## Login + +```shell +curl -k -X POST https://localhost:8080/api/auth/login \ + -H "Content-Type: application/json" \ + -d '{ + "email": "testHDFS@example.com", + "password": "Pass@123" + }' +``` + +## File upload + +```shell +curl -k -X POST https://localhost:8080/api/files/upload \ + -H "Authorization: Bearer $JWT" \ + -F "file=@/home/overnion/Desktop/Typing Speed/15-102-98.mp4" +``` + +## File download + +```shell +curl -k -X GET "https://localhost:8080/api/files/download/15-102-98.mp4?password=Pass@123" \ + -H "Authorization: Bearer $JWT" \ + --output 15-102-98.mp4 +``` + +--- diff --git a/Home.md b/Home.md index 5f2110c..9e82a64 100644 --- a/Home.md +++ b/Home.md @@ -5,3 +5,4 @@ Welcome to the Wiki. --- ## [1.1-TODO](1.1-TODO.md) +## [1.2-BACKEND-APIs](1.2-BACKEND-APIs.md)