How to use postman for backend
ฝัง
- เผยแพร่เมื่อ 8 พ.ย. 2024
- Visit chaicode.com for all related materials, community help, source code etc.
Welcome to chai aur code, a coding/programming dedicated channel in Hindi language. Now you can learn best of programming concepts with industry standard practical guide in Hindi language.
All source code is available at my Github account:
github.com/hit...
Our Open-Source Project is here: freeapi.app
Join me at whatsapp: hitesh.ai/what...
for community discord: hitesh/ai/discord
Instagram pe yaha paaye jaate h:
/ hiteshchoudharyofficial
HTML video series: • HTML and VSCode - gett...
Complete javascript series: • Javascript for beginne...
Complete Reactjs series: • React JS roadmap | cha...
Javascript and react interview series: • 1 call se shuru hui pl...
Backend development with Javascript: • Javascript Backend Roa...
Sir at 11:05, when you were facing an issue with fullName. Actually the issue was with the fullName spelling. You spelled it "fulName". Check it out.
bhai log mara system mei wo mongobd atlas aur cloudinary py upload ho rha hai laking mujy postmon mei mongodb server error dei rha hai keh rha hai localfield can't be empty string, jb ki mein sab de rha hou aur wo upload b ho rha ha.... plesae attention and help ????
@@ExploreSciFi Getting 500 internal server error.
Error: ENOENT: no such file or directory, unlink 'D:\Backend\ChaiBackend\public\temp\profileGithub.jpg'
at uploadOnCloudinary (file:///D:/Backend/ChaiBackend/src/utils/cloudinary.js:22:12)
at file:///D:/Backend/ChaiBackend/src/controllers/user.controllers.js:66:30
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Exactly
@@ExploreSciFi bro same problem here kuch solution mile toh plz batana
nice video thank you so much Sir
😍😍😍😍
00:03 Expect bugs in your code and debug it with attention
01:59 Using Postman for backend testing and sharing collections
06:03 Selecting and adding files in Postman for backend
08:03 Debugging and issue checking is important in backend development.
12:50 Using postman to upload and retrieve images in the backend
14:45 Automatically remove uploaded files for testing purposes
18:28 Issue of undefined property in JavaScript
20:17 Check if the request.data files have come and whether it is properly an array or not
23:58 Using Postman for backend development
25:32 Using Postman to create and organize collections
29:22 Using Postman for backend: Registering and sending requests
31:22 Using Postman for backend development allows for easy uploading and saving of files.
35:15 Fix all the bugs in the register controller
😍😍😍😍
A perfect video (playlist) for backend developers, it just teaches you so much and always keeps you in curiosity how things work behind the scenes.
great video.
I am learning new things.
in my previous backend project, I realise, I have done so many bad practices, now I will improve upon my old projects with newly learned practices.
Initially I found difficulty in backend but now understand flow of code after watching these videos.
i am watching and practicing and understanding little bit 😢 😢
same here
ek akela channel jo aapko sabkuch professionally sikhata hai wo bhi free me thank you so much sir 💗
bhai log mara system mei wo mongobd atlas aur cloudinary py upload ho rha hai laking mujy postmon mei mongodb server error dei rha hai keh rha hai localfield can't be empty string, jb ki mein sab de rha hou aur wo upload b ho rha ha.... plesae attention and help ????
Been on a problem for more than 2hrs, but finally debugged it myself. Initially, I didn't send the password while creating the user object. Earlier I used to panic a lot but due to Hitesh sir teaching and his continuous impetus on debugging, I don't fear errors anymore ❤❤
my code throw an error : throw new error ApiError ( 409, "User already exists with this username ")
can you help me
Your database might contain duplicate records based on your key. I mean you might have set email as true and then using the same email again and again. Check for that
sir, you are way too good. This level of content on youtube is next to impossible to find, but you made it available to us for free. Really, thanks a lot sir.
00:03 Expect bugs in your code and debug it with attention
01:59 Using Postman for backend testing and sharing collections
06:03 Selecting and adding files in Postman for backend
08:03 Debugging and issue checking is important in backend development.
12:50 Using postman to upload and retrieve images in the backend
14:45 Automatically remove uploaded files for testing purposes
18:28 Issue of undefined property in JavaScript
20:17 Check if the request.data files have come and whether it is properly an array or not
23:58 Using Postman for backend development
25:32 Using Postman to create and organize collections
29:22 Using Postman for backend: Registering and sending requests
31:22 Using Postman for backend development allows for easy uploading and saving of files.
35:15 Fix all the bugs in the register controller
😍😍😍😍
do you know what theme he is using?
Mera to uploadOnCloudinary function me catch wala block chlra ha usi ko debug krr raha hu 2 ghante se😂
@@techinfo4623 Chai Theme
@@techinfo4623 chai theme--> on vs code
@@techinfo4623 chai theme
Yes, sir mera bhi ./env nhi cla tha tb hi maine usko Google kiya or import ka tarika correct kiya tha!
It's one of the best playlist. I enjoy very much. Your smiling face and talking style awesome and unique.
hii sir i'm pankaj
sir maine chai aur code par backend ka series start kiya hai sir aapne isme coverImage upload cloudinary bata rahe the nahi ho raha tha par sir mere code direct chal rahe hai sir maine (const coverImageLocalPath = req.files?.coverImage[0]?.path) phir maine codition check bhi kiya sir phir bhi koi changing nahi mila but sir maine is code check laga diya maine (const coverImage = coverImageLocalPath ? await uploadonCloudinary(coverImageLocalPath) : null) sir mai bahut khush hu logic buliding ka matlab ye nahi ki aap kitne dsa ka question solve kara rahe hai iska matlab ye hota hai ki aap us code ko kis tarah se soch rahe hai i am very proud off you sir this chanel awesome 🙏
Hello Hitesh Sir, I wanted to express my gratitude for the amazing content you've been providing. I recently began learning backend through your videos and it's been an incredible experience.
1. Regarding the code you mentioned at 20:33, there's a handy shorthand we can utilize to fix the error using optional chaining. By using the following line of code, we can resolve the issue:
const coverImageLocalPath = res?.files?.coverImage?.[0]?.path
This shorthand allows us to apply optional chaining on arrays as well. Once again, thank you for your guidance!
2. If a user is already exist then the temp file will not be removed as multer runs a middle ware and if a user already exist then we directly throw an error but not removing the files from the temp folder.
can you share solution for 2nd point how can you delete the files if user exist
thanks for the chaining concept ,its way more convinient
I'm repeating watching videos and every time i repeat i get more confidence that i can build the same without seeing the code❤. I love this profession approach of setting up files. No words to thank you sir❤
Glad you think so 😃🙏
@@chaiaurcodesir please help me to solve this error ,I faced this problem while setting postman, earlier all was fine 😢MongoServerError: E11000 duplicate key error collection: videotube.users index: userName_1 dup key: { userName: null } at InsertOneOperation.execute (C:\Users\SRI RAM KUMAR\Desktop\chai-backend
ode_modules\mongodb\lib\operations\insert.js:48:19) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async executeOperationAsync (C:\Users\SRI RAM KUMAR\Desktop\chai-backend
ode_modules\mongodb\lib\operations\execute_operation.js:106:16)
@@chaiaurcode bhai log mara system mei wo mongobd atlas aur cloudinary py upload ho rha hai laking mujy postmon mei mongodb server error dei rha hai keh rha hai localfield can't be empty string, jb ki mein sab de rha hou aur wo upload b ho rha ha.... plesae attention and help ????
@@ExploreSciFi @chaiaurcode can you look into this error
Initially I found difficulty in backend but now understand flow of code after watching these videos. 🧡❤
Hello Hitesh, you are doing a very great job. Keep it up..Always wanted to see a production grade professional code....You are making that happen....
Hitesh bhai ye course paid course se bhi bahot jyada superior h , thanks
Its amazing series. Here i'm learning how professionally code works❤
i already debug my code every times before your debuging...and also fixed bug that time....because of you sir.....thankyou so much sirr....
throw new error ApiError ( 409, "User already exists with this username ")
can you solve this error
for all those who are getting avatar is required problem I resolved the issue by following steps
1. check the files path
2. do different console.logs and check where is the error
3. check the cloudinary func and compare it with sirs
4. you can also check your environment variables file
mine error was in cloudinary func as i was writting v2.uploader.upload rather than i should have wrote cloudinary.uploader.upload
thanks hope your error got resolved
my cloudiany return null how can fix?
@@biketips1337 might be the local path is wrong
@@biketips1337 same here bro how can fix?
could you share your code snippet
@@ultimateintimater brother have you fixed the issue?"share snippet"
Ram Ram Sir G
pata hi nhi tha ki postman ka use is tarah bhi kiya ja sakta hain
lots and lots of thanks
Ab to mai jab bhi youtube kholta hun to sabse pahle chai aur code ko check karta hun ki koi naya video aaya hai ki nahi , kabhi kabhi youtube notify nahi kar pata hai ya fir notification par dhyan nahi jata hai in cases.
bhai log mara system mei wo mongobd atlas aur cloudinary py upload ho rha hai laking mujy postmon mei mongodb server error dei rha hai keh rha hai localfield can't be empty string, jb ki mein sab de rha hou aur wo upload b ho rha ha.... plesae attention and help ????
You are damn right sir. Sirf dekh k copy karney sey kuch nahi hota. I spent 4 hours today debugging the code written from my own hands. And most of them typo or missing schema.
Great Video ❤
I have two Question
1 ) why are we passing two different status "201" in status Code and "200" in response body
return res.status(201).json(
new ApiResponse(200, createdUser, "User registered Successfully")
)
2) Why are we throwing error in response instead of error can we pass an response with error message?
or we are going to build this in future?
1) both 200 and 201 indicates successfull responses
Generally 200 ( OK ) status code is used for successful resquest.
201 ( created ) status code is used when the request is fulfilled and result in the creation of new response.
These code are industry standards , but you can use any status code between 200 and 299.
Sir, explained these things in HTTP headers crash course, please refer that.
2) Yes, you can pass an error with a response like :
return res.status(400).json({ error : "error occurred"})
Yes, i do have same doubt with the error message that we should use the res.status() and json() with the ApiError class to send our API error's as a response. Maybe it will be very helpful in Frontend side i guess. Correct me if i am wrong. Thankyou
Hello, Sir, there are several videos on backend on this plateform, but your videos stands out as the best. Most of the videos on youtube teach and show certain concepts of backend , but non have been avaible to link those concept with overall logic building for the backend. You hvave been doing a remarkable work sir, thanks a lot
sir meri pehli salary tu apko hi duga
mili ki nahi
😂
such indepth content is hardly available anywhere . Loving this series sir
I encountered two unexpected errors during my project, but I managed to resolve them. Sharing this in case it helps someone else:
1) When using the .env file for sensitive information like a secret key, I initially masked it using asterisks (***********). However, this caused an 'Invalid Signature' error. The fix was to ensure the secret key not in asterisks format.
2) I faced issues while setting up the MONGODB_URI. Adding the query parameters ?retryWrites=true&w=majority resulted in an error, preventing the creation of my database collection. Removing these parameters resolved the issue.
Hope this insight saves someone else valuable time and frustration! Thank you for sharing your experiences.
Thank you bro. I was getting the Invalid Signature error. Go to see I have set the secret same as api key.
sir I lovedd this video. it took me 3x time to complete this one. because i got so many errors of my own and their i went ahead to study about them and debugged all on my own, I also added a lot of checks on the password, email etc and taken care of some other cases like when user already exists then we need to unlink files from local in that case
sir is await ko na lagane ki wajah se mujhe 1 hour error ke saath await kardiya 😥😄😄
watching at 3 am in the morning..writing code with chai is just a different feeling..thank yuou sir ji
Toh subah kya kar raha tha
If we do not provide the any field property in the request body from the client, the code will proceed without error so i think it might be great to apply as
if ([username, fullName, email, password].some(field =>field ===undefined || field?.trim() === "")) {
throw new ApiError(400, "All field are required !!");
}
thankyou bro for help, this was actually an issue, but I was unable to think about its solution.
Thank u hitesh for providing us production level standard code or concept
const coverImageLocalPath = req.files?.coverImage ? req.files?.coverImage[0]?.path : "" this thing work for me in empty coverImage.
btw Thanks for this master playlist
First message just for Hitesh Sir Gem, 8:45 same error(fullname->fullName) was with me also, keep doing keep growing sir , ❤❤❤❤❤❤❤❤❤
I have used postman earlier to very basic testing but never had confidence to say Yes I know postman, but after this video I can say it very confidently. All thanks to you sir❤. Hope to meet you soon.❤
I was so much excited to learn this lecture. I was like "First I'll learn this then I'll watch PBKS vs RCB" :)
00:03 Expect bugs in your code and debug it with attention
01:59 Using Postman for backend testing and sharing collections
06:03 Selecting and adding files in Postman for backend
08:03 Debugging and issue checking is important in backend development.
12:50 Using postman to upload and retrieve images in the backend
14:45 Automatically remove uploaded files for testing purposes
18:28 Issue of undefined property in JavaScript
20:17 Check if the request.data files have come and whether it is properly an array or not
23:58 Using Postman for backend development
25:32 Using Postman to create and organize collections
29:22 Using Postman for backend: Registering and sending requests
31:22 Using Postman for backend development allows for easy uploading and saving of files.
35:15 Fix all the bugs in the register controller
This is purely high quality production level code wirting testing and debugging . Thanks for uploading such great content for free!!
The knowledge of using Postman was fabulous
Thanks sir me ek dum comment nhi kr pata kuki job bhi sath me but me full support rkh rha hu...Continue rkhe bss aap iss series ko ❤
sir almost i watched two to three time video again again.. and my confident build to make project without watching video.. just i follow the step.. also i am waiting for next video.
After a long time but ALHAMDULILLAH my code is running❤
Love the depth of this full free backend course
Main itna khus hun ki mai apni khusi ko kaise jaahir karoon ki *Jo chij hame paid me bhi nahi milti hai hame yaha free me mil rahi hai* thank you to much sir ji *Dear Hitesh Chaudhary SIR ( CHAI AUR CODE )* ❤❤❤❤❤❤❤❤❤❤❤❤ Ager aapko mera comment accha laga ho thodi bhi. to please next video me mera bhi zikar to banta hai
10:36 Spelling of fullname was wrong sir, not used double l
22:27 Alternative way is : req.files?.coverImage?.[0].path;
Thankyou Sir, from bottom of my heart, will always have respect for you, for giving this kind of knowledge to us.
The student will always remember you for changing there life and making corporate life easy.
exactly i was just about to type this
Bhut in depth series h.
Aaj mere ek friend ne jab bataya tab pata chala 🫡
#chaiaurcode sir I'm following you from javascript and react courses and I've learnt a lot from you. I want to complete whole backend series with you sir🙏.. lots of respect for your quality content and teaching style ❤❤❤🙏
i comment on this video 4 month before , becouse hitesh sir say if this video reach out ,,....number of comment so i will post next video , so i comment on this video 4 month before but watching / start this series from start before 10 days 🤣🤣🤣🤣🤣🤣🤣🤣🤣🤣
{{
________thanks hitesh sir__________--
}}
why for valueble content dene ke liye .......
particularly iss video me bohot zyaada mazaa aaya sir
😊☕️
when he says "uski fir kabhi charcha krenge" i actually think he'll upload a video on that topic
i am doing this complete project is typescript, although it it is more time than usaul but i am staring to see the fruits of my labour when im not getting those annoying undefined error 😌.
Its amazing series. Here i'm learning how professionally code works❤
fulName ki spell mistake thi sir when you rewrite you add that L -> fullName great sir learn a lot thanks
Love from pakistan. best tutor in the world of development
Hello, sir I think there is a bug in utils/ cloudinary need to import .env to provide an API key and another credential to cloudinary configuration this suffered a lot since morning but I have enjoyed a lot to fix this bug. even this could not avoid to imporation "dev": "nodemon -r dotenv/config --experimental-json-modules src/index.js". thank you. Best of luck sir .
Thank you sir for all your efforts, I assure you if this project is entirely completed, this will be one of the most brilliant series on youtube, there is not a single creator explaining these complex concepts with such a simplicity and yeah with that cute smile 🥰 throughout the video. Thanks a lot sir.
Complete nahi hua...80% Khuud ko hi karna he
Ohhh God finally after more than 4 hours I solve one error but feel too good because I solve this error
Once again thanks for starting this amazing backend series ❤
Dark mode in mongo:
Mongodb atlas > user dropdown menu on top right corner > user preferences > dark mode. you're welcome!
Thanks sir, for such a things teaching in free ❤
thank you sir for sharing about postman production things
I have few questions:
1) Since files are stores in the server first, what happens if two different users try registering with same file name at the same time. Won't it create conflict in the server? Rather, can't we directly upload the file to cloudinary?
2) We are making the assets in the public folder available to everyone right? That will be privacy issue right?
I haven't looked at these issues myself at this point. Will try to figure out.
Great video as always. Thanks a lot for this effort.
One thing missing in this Postman Topic is how to professionally document the APIs in Postmant. It is very important for better collaboration among the Backend Team and with Frontend Developers as well.
So, please create a video about that too.
Thank you again!
25:22 - Important to know postman part starts here. production level
Sir ji, Could you please consider creating/adding a video on Dockerizing this project and setting up an Nginx server after completing this project? It would be a fantastic way to get a taste of DevOps and learn more about deployment and containerization. Ager ispe Reply nehi Karoge toh Sir dusri wali Video pe bhi same comment kar dunga 😶
The same check must be applied for the avatar also as if it is not passed, the same error comes rather than the later one(avatar is required)
sir g aj 12 din ho gye koi new video nahi ayi backend ki?
sir I really wanna learn it as soon as possible.
I really like your videos and the way you are teaching each and every detail is awesome.
Now I'm waiting for backend with JavaScript part 2 .
Time Stamp : 13:50 , Hi Hitesh, for dark mode in MongoDB go to In your profile -> ATLAS -> User Preferences -> your can change according to your preference -> Light mode -> DarkMode -> Auto with OS (according to system preferences).
20:08 This can also be done with optional chaining. Often, we stuck in such small mistakes which are really hard to debug, sir. Maybe you didn't notice that you didn't chain when accessing the entry of coverImage array. This can be fixed easily with req.files?.coverImage?.[0]?.path; if the array has entries, then access it.
bro esme toh cloudinary pe file toh nahi ho rahi hai par avatar ho rahi hai
Sir at 11:05, when you were facing an issue with fullName. Actually the issue was with the fullName spelling. You spelled it "fulName". Check it out.
feeling awesome after getting this amazing course. Thank You sir ❤
Wonderfully registered user at the first attempt. Very excited. :D
Thank you sir for providing us production level standard code
22:20 Alternate code :
const coverImageLocalPath = req.files?.coverImage?.[0]?.path;
Explanation :
optionally check for the 0th index of the array
In other words, check for the 0th index of the array named coverImage ONLY IF THE ARRAY NAMED "coverImage" IS PRESENT
A perfect bindup for POSTMAN Fire bhai Fire
Sir. .. you r the best.. you make me speechless .. thank you so much..
learning on 25-sep-2024
Thank you forever !
Amazing video but may be its bit overwhelming for beginners but still you did an incredible job
so interesting and helpful lecture. Thanks sir. God Bless you.
sir dark mode is there in mongodb.
The way you explain is the best i have ever seen
22:00 pe if else ki jagah ham aise bhi chek kar sakte the hai na
const coverImageLocalPath = req.files?.coverImage && req.files?.coverImage[0]?.path;
if req.files hai to usme coverimage dekho or agr vo bhi mil jaye to yske 0th index se path le lo
It takes me 3 hour to solve error one error solve another error comes but at last it run properly which feel great
.env and env running with both but there came other errors or say bug that I solved by myself not so complicated but yeah! I did it. Thanks to Hitesh Sir how he told how to debug by going back, where could be a bug and other..
Absolutely loved the tutorial on building logic and using Postman for backend development by Chai aur Code. Thank to Hitesh sir for the insightful content!
this is going to be amazing backend series. Thanks you sir
i just code today 12 hr - and maza aaraha h e
Correct me If I am wrong
But in 20:37 instead of if-else checking i just change the code like this const coverImageLocalPath = req.files?.coverImage?.[0]?.path; and it was still work either if we send data or not. Thanks in advance
I have also done the same
Sir ye series Stop Mat karna. Love From 🇧🇩
Thanks ,finally found my bugs and fixed it also thanks you again very worthful content.
Thank you sir ji
Great Backend series Sir Thank you🙏
Hitesh Sir You are doing great job as start new channel with this and in specially Hindi and open source
nicely covered the postman topic ..
20:02 Error can be fixed by adding optional chaining to the array index without using classical way
const coverImageLocalPath = req.files?.coverImage?.[0]?.path
Daily consistent 1 video is a good schedule
#chaiaurbackend #ChaiAurBackend #backenddevelopment. I cant wait to see hithesh sirs course 🤗
Sir, your content is truly remarkable. I am grateful for your expertise and guidance, sir.
The moment you made post request for register user without putting any column. Backend should return error that fileds can't be empty. Whereas it's returning avatar is required.
.
I think code should be changed in async handeler catch block
i am also getting same error.... did you solve it?
Your videos are definitely about development but i am learning more debugging in here!😂😂
At 19:00, by adding `?.` one more time after coverImage we can simply check that coverImage is undefined or not an array.This will prevent our code from crashing. i.e
const coverImageLocalPath = req.files?.coverImage?.[0]?.path;
same goes for avatarLocalPath :)