How to use postman for backend
Вставка
- Опубліковано 23 сер 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)
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 😢 😢
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
😍😍😍😍
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 ❤❤
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.
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
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.
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.
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 ????
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 🙏
Initially I found difficulty in backend but now understand flow of code after watching these videos. 🧡❤
sir meri pehli salary tu apko hi duga
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
Hitesh bhai ye course paid course se bhi bahot jyada superior h , thanks
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 ????
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....
Ram Ram Sir G
pata hi nhi tha ki postman ka use is tarah bhi kiya ja sakta hain
lots and lots of thanks
Love from pakistan. best tutor in the world of development
Its amazing series. Here i'm learning how professionally code works❤
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 ????
i already debug my code every times before your debuging...and also fixed bug that time....because of you sir.....thankyou so much sirr....
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
sir is await ko na lagane ki wajah se mujhe 1 hour error ke saath await kardiya 😥😄😄
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
This is purely high quality production level code wirting testing and debugging . Thanks for uploading such great content for free!!
Thank u hitesh for providing us production level standard code or concept
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.
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.
const coverImageLocalPath = req.files?.coverImage ? req.files?.coverImage[0]?.path : "" this thing work for me in empty coverImage.
btw Thanks for this master playlist
I was so much excited to learn this lecture. I was like "First I'll learn this then I'll watch PBKS vs RCB" :)
First message just for Hitesh Sir Gem, 8:45 same error(fullname->fullName) was with me also, keep doing keep growing sir , ❤❤❤❤❤❤❤❤❤
After a long time but ALHAMDULILLAH my code is running❤
#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 ❤❤❤🙏
Dark mode in mongo:
Mongodb atlas > user dropdown menu on top right corner > user preferences > dark mode. you're welcome!
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
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
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.❤
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
thank you sir for sharing about postman production things
particularly iss video me bohot zyaada mazaa aaya sir
😊☕️
#chaiaurbackend #ChaiAurBackend #backenddevelopment. I cant wait to see hithesh sirs course 🤗
thanks and love you sir for your valuable content💖💖☕☕
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 ❤
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
Wonderfully registered user at the first attempt. Very excited. :D
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.
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 .......
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!
nicely covered the postman topic ..
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!
Thank you sir ji
this is going to be amazing backend series. Thanks you sir
The knowledge of using Postman was fabulous
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"
very well explained sir,
eagerly waiting for the next video 🔥
BEST TEACHER EVER
Daily consistent 1 video is a good schedule
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.
sir dark mode is there in mongodb.
The way you explain is the best i have ever seen
thank you sir for your quality contribution !
Thanks ,finally found my bugs and fixed it also thanks you again very worthful content.
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
so interesting and helpful lecture. Thanks sir. God Bless you.
Love the depth of this full free backend course
when he says "uski fir kabhi charcha krenge" i actually think he'll upload a video on that topic
feeling awesome after getting this amazing course. Thank You sir ❤
Sir, your content is truly remarkable. I am grateful for your expertise and guidance, sir.
Hitesh Sir You are doing great job as start new channel with this and in specially Hindi and open source
Great Backend series Sir Thank you🙏
Sir. .. you r the best.. you make me speechless .. thank you so much..
Thanks you sir for this amazing video
Thank you Sir for this series
fulName ki spell mistake thi sir when you rewrite you add that L -> fullName great sir learn a lot thanks
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 :)
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
great video sirji as always
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).
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 ye series Stop Mat karna. Love From 🇧🇩
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 .
It takes me 3 hour to solve error one error solve another error comes but at last it run properly which feel great
I gave 3-4 hours only in debugging sir. I was feeling irritated a lot. But thanks a lot for the video please do make such videos
Amazing video but may be its bit overwhelming for beginners but still you did an incredible job
Loving the series sir
Now learning react seeing this loved it sir please keep it up
Also interested like this deep content
Toooo much knowledge, Love you Sir
nice video thank you so much Sir 😍😍❤❤
Thank you sir for providing us production level standard code
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
25:22 - Important to know postman part starts here. production level
Sir backend series me 😉 aanand aaya gya and ab to doubts 🧐 bhi nhi mil rahe😅
Abhi to full debugging b krenge saath me
Saras
@@chaiaurcode
@@chaiaurcodesir series dec tak complete ho jayegi n ?
BTW it's best series on yt
this content is great , loved while reading so many new concepts
I enjoyed it a lot. As always thank you so much.
if you have any query so pless tell me i answer you so be carfull an tack care byyeee
Thank you so much sir for bringing such a high quality content for us🎉🎉❤❤
amazing
_id : BSON data
use form data option in postman while posting files
raw and json format is choosed only for text :: "04:25"
remove file synchornously when uploaded successfully and in case of error : "14:18" fs.unlinkSync(localfilepath)
req.files "16:42"
postman collection : "25:30"
postman environment : "28:10"
Please launch chai aur frontend series
once again thank you so much sir for wonderful knowledge share. 👌👨💻