Logic building | Register controller

Поделиться
HTML-код
  • Опубликовано: 18 окт 2024

Комментарии • 1 тыс.

  • @GauraV-uc2oi
    @GauraV-uc2oi 6 месяцев назад +73

    Finally all the pieces are coming together. It's like watching movie where someone is trying to solve a mystery. Thank You Sir for this amazing explanation.

    • @ek_hai_coder
      @ek_hai_coder 2 часа назад

      Literally i am also feeling this

  • @abhimanyupayasi
    @abhimanyupayasi 11 месяцев назад +37

    00:03 Logic building is achieved through real-world software projects
    02:06 Logic building exercise helps in breaking down problems into small steps
    05:40 Validation and file checking are important steps in register controller.
    07:36 Extract URL from the response and check for successful avatar upload
    11:23 The user details are extracted from the request body with a destructure operation
    13:19 Testing the data using Postman
    17:16 To use the uploaded file in the register route, add the upload middleware and use the 'fields' option to accept multiple files.
    19:01 Creating an array with two objects for accepting avatar and cover image files.
    22:36 Using the dot sum method to check if fields are empty
    24:24 Checking validation and user registration in a JavaScript code
    27:57 Retrieve user email based on username
    29:47 Logic building for registering controller
    33:22 Upload cover image and avatar image
    35:15 Upload your file on cloud using a method
    38:49 Creating an entry in the database with Avatar object
    40:41 Ensure validation of cover image and handle cases when it is missing.
    44:07 Use Find by ID to find a user and ensure successful creation
    46:04 Creating a properly structured API response
    49:44 Creating a new object with given status code and data
    51:33 Register controller and bug fixes

    • @abcxyz-b3h
      @abcxyz-b3h 10 месяцев назад +2

      are you using merlin for comment?

    • @abhimanyupayasi
      @abhimanyupayasi 10 месяцев назад

      @@abcxyz-b3h yes bro !!

  • @zia-kayani
    @zia-kayani 10 месяцев назад +10

    Hitesh sir , i have been learning coding from many indian channels but your way of teaching and selection of words is unique and next level..
    now a days i only visit chai aur code + hitesh choudhary .
    thanks and love from pakistan 💓

  • @madhavvijay5173
    @madhavvijay5173 7 месяцев назад +3

    Best Development Series I have seen till yet with great level of work. Hats off to you 👍👍

  • @dheerajsahni8073
    @dheerajsahni8073 11 месяцев назад +7

    Sir aap jabse hindi language me aaye ho, aapne bawaal hi macha diya hai market mein ❤❤😮

  • @HassanMurtaza571
    @HassanMurtaza571 7 месяцев назад +2

    bohat achay lectures hain ap k sir ....
    post man main jahan ap url type kr ray hain us k agay cancel ka button hai responce ko stop krnay k lia or agar server restart krtay hain tab b post man ka request standing process stop ho jata hai ... baki love you sir g production level ka parhanay k lia😍😍😍😍😍

  • @Prakash-Raut
    @Prakash-Raut 11 месяцев назад +8

    I saw your first video at the college wallah channel and I must say I've never met anyone like you before I've been a fan of your teaching style from day one and I started following you and till now I've watched all your videos. Thank you so much for the amazing content. Love You 3000 ❤

  • @arnabgaming2453
    @arnabgaming2453 10 дней назад +1

    Absolutely the most in depth and easy to understand backened series on youtube, Keep it up sir❤

  • @Shriramkrishnhari
    @Shriramkrishnhari 11 месяцев назад +3

    I can say after analysing my way,
    Anyone can learn as calmly U say..
    I have watched a video U made one day
    U R respected as well as "they"
    🌟🌟🌟🌟🌟😊

  • @parampatel6345
    @parampatel6345 15 дней назад

    finally all the dots are connecting now. I have learned react from your Chai aur react course. Thank you so much for providing such a quality learning courses. You are doing a great job 😀❤

  • @mrgtxgamerz1
    @mrgtxgamerz1 10 месяцев назад +62

    1. first the user send the data
    2. then we have to take the data from body
    2.1, check if all required fields are available or not
    3. then in our regsiteration model we have to find the user if present in it then we return without registering the user
    4. if user not present we create the user in the database
    5. then we sent the message that user created successfully

    • @Dfourw
      @Dfourw Месяц назад +1

      then in our regsiteration model we have to find the user if present in it then we return without registering the user +++ in this case we return login method

    • @piyushgaming4270
      @piyushgaming4270 17 дней назад

      i don't think the step 3 is need because in user model we put the unique email and username with unique : true
      if there is a user with same username or email id in the db then mongoose should return error and then we just pass that error to the user/client

  • @mr_doc-.-
    @mr_doc-.- Месяц назад +1

    Aaj puri clarity aa gayee ki kyu hum utils bana rahe the. Bohot kuch sikhne ko mila. ❤❤

  • @ozge-yagizfan
    @ozge-yagizfan 11 месяцев назад +4

    Sir big fan of you , never stop teaching us , In Sha Allah aap k subscribers bohot barh janay hain, ap ki serires seriously best serires hain, love from Pakistan

  • @Ali-2812
    @Ali-2812 2 месяца назад

    So after all that time learning coding, I can finally say I know how different pieces of web development come together to form an application. Kudos to the very Guru of programming for such an amazing lecture.

  • @mirzafirozuddin173
    @mirzafirozuddin173 11 месяцев назад +9

    steps:
    1. Get required fields from user.
    2. Validate the received fields.
    3. Check user already present in db or not. If yes don't save data to db and send a response to user.
    4. If not then hash the password and save data to database.
    5. Generate access token
    6. send response with status code

  • @SoburHossainMolla
    @SoburHossainMolla 2 месяца назад

    i was so dissapointed watching a bunch of videos here and there for backend.But truth be told this playlist made my concept crystal clear.I must appriciate your teaching process .You divide each concept in chunks and explain all of the working flow of codes and each logic.Take love from bangladesh.Your are a gem that i found on youtube.This type of course should not be free,but luckily people like you helping us by teaching free.Thank you❤❤

  • @DeepakKumar-oz5ky
    @DeepakKumar-oz5ky 7 месяцев назад +4

    for regestration we will take data from frontend ,where we can take data like name,username,email, and password.
    second from my view it will check this user is exist or not if that user is existed it shows some thing like this use has benn already created .so we make condition for that or write code for that . this user is unique so we wll take his password and hash. and then it shows users has been created . this much i have think. in my first view, now its time to check what hitesh sir will teaches us.

  • @henilchhipani
    @henilchhipani 9 месяцев назад +2

    sir amazing videos i am not building this same project just learn from this project and apply it to my project. by the way I am building CRM system enjoying your work.

  • @AbyaktaSwain
    @AbyaktaSwain 11 месяцев назад +3

    Big fan sir
    Your teaching is very help full to me.
    Big respect for you sir🙏🙏🙏

  • @divasbhadani9225
    @divasbhadani9225 6 месяцев назад

    chai aur code me hi possible h, chota rahte h video bol ke 52:48 min ka padhaa diya apne sir ji aur pata v nai laga
    Hats off to you sir ji
    You rock, i tried to learn backend but i stopped multiple time but your playlist is soo amazing, just wanted to watch next video and learn.
    Thank you soooo much for such a free course 🙏

  • @pratyushgaming9522
    @pratyushgaming9522 8 месяцев назад +4

    sir hats offf!!!! 15 minute se toilet laga hay...itna interesting lag raha hay...uthne ka mann nehi kar raha...

  • @mujeeb353
    @mujeeb353 4 месяца назад

    Hitesh sir, I have been learning coding from many Indian channels but your way of teaching and selection of words is unique and next level.
    now a days I only visit chai aur code.
    thanks and love from Pakistan.

  • @pgrAbhilash
    @pgrAbhilash 10 месяцев назад +4

    24:34 We can also check the fields whether it is empty or not in this way
    if(!fullname || !username || !email || !password) {
    throw new ApiError(400, "All fields are required!");
    }

    • @patiljay956
      @patiljay956 9 месяцев назад

      LCO course method

    • @sahilpawar5152
      @sahilpawar5152 9 месяцев назад

      Better way can be to check it in some() function
      `if(
      [username,fullName,email,password].some((field) => field?.trim() === "" || field === undefined)
      ){
      throw new ApiError("Please fill all fields",400);
      }` i was confused bcz of this for 4 days🥲

  • @Yamraj-se4hh
    @Yamraj-se4hh Месяц назад

    guruji dandwat pranam aapko... aapke channel se mai itna kch seekhte ja rha hun ki abb development/programming mein mja aa rha hai... Hats off you sir.... agr merko kabhi jeevan mein aapki madad ka awsar mile toh m peechhe nhi hatunga

  • @PriyangDesai-u2r
    @PriyangDesai-u2r 4 месяца назад +3

    understood++

  • @emio_op
    @emio_op 11 месяцев назад

    if you are facing trouble in understanding the video.
    25:00 stop here
    take a break of 5 mins
    Come back And watch the rest of the video.
    ( it’s nothing but pomodoro technique )

  • @HimuPra
    @HimuPra 6 месяцев назад

    From Bangladesh 🇧🇩!
    Thanks to Bollywood for teaching me hindi.....this course is soo insane, I can't believe its free.
    Thanks Hitesh Sir!

  • @SarveshKumar-08
    @SarveshKumar-08 10 месяцев назад +1

    Fantastic tutorial on logic building and register controller! This video provides a clear, step-by-step guide to mastering problem-solving skills in software projects. Highly recommended for anyone looking to enhance their coding knowledge.

  • @princeyadav5667
    @princeyadav5667 5 месяцев назад

    shortest video i ever seen. I didn't realize where the one hour goes. Thankyou so much sir...

  • @himanshuhardiya6060
    @himanshuhardiya6060 Месяц назад

    Amazing, how all earlier explained work and concepts are used to together to write the logic in controller, WOW.

  • @aniksaha8108
    @aniksaha8108 7 месяцев назад

    Such a nice video on controller. I learnt how to think properly, when you asked us to pause and think I paused and only made 4 steps but there is so much more to do. Such a beautiful logic written

  • @shriyagupta725
    @shriyagupta725 3 месяца назад

    Amazing video with deep explanation thank you alot sir for teaching in such a great way you are making coding easy to learn

  • @anujchhikara-zy4mx
    @anujchhikara-zy4mx 7 месяцев назад +2

    1. First we try to get the user data from req.body
    2.then once we got data we can validate it with some middleware if data we are getting is in correct format
    3. Then import user from model to create new user and store it in our database and use try and catch
    4. If success then send status of 200 and some messages like successful register
    5. If not then some status code like internal server error or failed to register

  • @mysterious_billionaire
    @mysterious_billionaire 4 месяца назад

    Wow the most in depth user registration video ever......

  • @HarshilB2S
    @HarshilB2S 23 дня назад

    one of the best video of backend series. Thank you very much sir :)

  • @DheerajShrivastav
    @DheerajShrivastav 10 месяцев назад +1

    best course in terms of explanation, and how he is not wasting time in explaining js instead focusing on explaining the actual logic and db related terms 🔥🎉

  • @blueiland4611
    @blueiland4611 Месяц назад

    Thank you sir, to give New changes to my development journey

  • @yashKoyani-y6y
    @yashKoyani-y6y 2 месяца назад

    Your Series is as best as the straight drive of Sachin Tendulkar sir

  • @AbheyKhurana-tc6be
    @AbheyKhurana-tc6be 5 месяцев назад

    Sir you have such in depth knowledge of every topic, Thanks for sharing all of it

  • @hunterYoutuber29
    @hunterYoutuber29 11 месяцев назад +1

    I just wanna say that your videos are best for a beginner.....best to start with any course....the context it provides is straight forward that i find confusing elsewhere...i don't get the things at first but watching your videos your tutorials does provide the confidence that I can do it...and that just means more than anything to me.... Thankyou ❤

  • @KattameediVishnuvardhan
    @KattameediVishnuvardhan 10 месяцев назад +2

    for rgistering the user
    1.take the data from the user
    2.validate the given data
    3.if the data is valid then store it your DB
    4.then send response to client that registration is succesfull

  • @ArjunSingh-wo1tg
    @ArjunSingh-wo1tg 5 месяцев назад

    Again ,The most beautiful line of this vedio is - "jitna code likhne me time nhi bitate us se jyade debugging me aap time bitate hai"🙏🙏❤

  • @techjagat4714
    @techjagat4714 5 месяцев назад

    Thank you Sir making this series very simple and Informative ❤❤

  • @harshitkaushal1584
    @harshitkaushal1584 5 месяцев назад

    This was made so understandable becuz of your efforts! hats off to you.💖💖

  • @sudipsarkar1512
    @sudipsarkar1512 3 месяца назад +1

    Guys ... Plz don't ignore the hardwork of Hitesh sir .. just bcz he's comfortably teaching us...If you are following this playlist.. by now , you might already have known what a mind-blowing series this is ! All pieces are coming together... This is undoubtedly the best course for backend foundation out there ❤.. plz keep supporting sir .. hope sir won't delete this masterpiece as it's still very underrated.. we have to admit : we all are extremely lucky that this level of content is freely available for us ❤

  • @adityayambal1756
    @adityayambal1756 5 месяцев назад

    Best Unpaid course which is far better than paid courses.. Thank You Sir

  • @anuragdubeydubeyji6783
    @anuragdubeydubeyji6783 11 месяцев назад +2

    Best series of javascript backed on youtube... Aag laga di bhaiya ji 🎉

  • @krishna.vineet
    @krishna.vineet 3 месяца назад +1

    Was a great video, abhi tk lag rha tha ki kya chal rha h ye backend me... But now it is, kya mast chal rha h Backend Course 😸

  • @afzalhamdulay
    @afzalhamdulay 4 месяца назад

    gajab deep coding thi video mai! kuch code difficult th samajhne mai, par worth it hai full on!

  • @VikashRoshan
    @VikashRoshan 5 месяцев назад

    a big thanks for covering all the intricacies in such a beautiful way

  • @dopaminesero6390
    @dopaminesero6390 11 месяцев назад +2

    your experience is next level sir, they way you teach fundamentally..

  • @hasnainmemon_01
    @hasnainmemon_01 5 месяцев назад +1

    best educational channel in the world ❤

  • @ravisingh5906
    @ravisingh5906 10 месяцев назад +1

    now, after 12 videos , it is making sense , thanks for so much efforts sir

  • @hamzazafar7999
    @hamzazafar7999 4 месяца назад

    Best video sir ❤❤. Finally i got to know that why we were writing code for diffrent utilities like multer and cloudinary and Api response etc ....... 🤣🤣❤❤

  • @RoshaniWankhede-rf4rw
    @RoshaniWankhede-rf4rw 8 дней назад

    Best video on logic building of course💌

  • @vishal-shinde
    @vishal-shinde 7 месяцев назад

    Very good detailed video on register api route!
    took time to understand properly

  • @tuhinghosh9737
    @tuhinghosh9737 2 месяца назад

    It's like a movie of Christopher Nolan. All the dots are connected in the end ❤
    Amazing explanation sir ❤🎉

  • @seemadeshmukh7079
    @seemadeshmukh7079 6 месяцев назад

    Excellent course !!! It is one of the best so far.

  • @atharvadeshmukh6328
    @atharvadeshmukh6328 5 месяцев назад

    This is the best backend series online!!

  • @Debraj-HTC
    @Debraj-HTC 8 месяцев назад +2

    learned so many new methods to validate, Thank You!

  • @PrashantKumar-rc5hl
    @PrashantKumar-rc5hl 11 месяцев назад

    this video made my day thank you sir, agr possible hota me aapke liye jmin se upr hmesa chlne ka intejam kr deta.

  • @AbhinavPt
    @AbhinavPt 2 месяца назад

    1.) the user sends data about itself under specific keys.
    2.) the function takes the specific input from the user, parses it
    3.) checks if the user with those details is already present or not
    4.) adds those fields of data to the database, under a try catch handle.

  • @GagandeepSingh-ip8dm
    @GagandeepSingh-ip8dm 8 месяцев назад +1

    1. send data from th user.
    2. check if the required fields are there.
    3. check if there is any duplicate entry for the unique fields in the database.
    ( we can send the required message if anything missing or duplicate entry)
    4. If all data is fine, then we save the user in the database, and send the success message.

  • @izharulhaque43
    @izharulhaque43 11 месяцев назад +1

    Thanks for amazing tutorial. 16:01 Please click on CANCEL button in postman to stop response.

  • @Dev-Phantom
    @Dev-Phantom 6 месяцев назад +1

    Multiple new things to learn in this Lecture.

  • @NOT_TON_Fan
    @NOT_TON_Fan 11 месяцев назад +6

    Sir agar video ban gyi hai to aaj hi premiere kar dijiye na, 35h baad ka premiere kyon set kiya hua hai..

    • @anonyone8834
      @anonyone8834 11 месяцев назад

      Taki consistency bni rhe

  • @KhushiVerma-y6t
    @KhushiVerma-y6t 4 месяца назад

    outstanding explanation sir har ek word samajh aaya : )

  • @neerajrawat0275
    @neerajrawat0275 8 месяцев назад +1

    first step make middle ware that trigger the route. ex. app.use("/register", routename)
    step 2 handle the route like give method post in the routname.js and give the function that will execute using the contrroler function
    step 3 write a controller function logic means the mongodb.connect import mongodb to save the data import the schema of the user login so that the monogodb can be connect and for the lmage we have 2 use the utility of the cloudinarry that we already made the earlier

  • @BrajeshchandraT
    @BrajeshchandraT 10 месяцев назад

    very deep and simple explanation. First time found something like this♥😍

  • @alexdsdebasis
    @alexdsdebasis 7 месяцев назад

    Bahat bahtat dhanyavad sir , itna indepth jaake aur bahat asanise samjha diye itne sare chijj. mnai user registration sikha tha ajj images upload karna bhi aagay.Thank You #HiteshSir

  • @devanand4269
    @devanand4269 10 месяцев назад

    Thank you sir kaafi chize samjh aayi tbh jada mza backend me ara hai frontend se❤❤

  • @shoaibhasan4026
    @shoaibhasan4026 10 месяцев назад +1

    In paid courses you can't get this treasure.
    Hats off Sir ❤

  • @tipssedlife
    @tipssedlife 10 месяцев назад

    Very very optimized video, and you have taught every single bit of code in a flow. 🤝

  • @DevSharma-vx3ip
    @DevSharma-vx3ip Месяц назад

    1) We will receive the details of users as params
    2) We can check in our database whether that user already exists or not.
    3) We can send the response message and status accordingly eg. User already exists! or User register successfully! etc
    That's my brute force idk if its correct or not

  • @wasimshariff9701
    @wasimshariff9701 10 месяцев назад

    sir the level of knowledge you have is really unmatchable.....👌👌❤❤..

  • @mr.saifee
    @mr.saifee 3 дня назад

    words are not enough to describe your efforts

  • @phoddaal7130
    @phoddaal7130 6 месяцев назад

    1) got user information from its input
    2) checking if user not already exist from his email and inserting these details into db
    3) sending response as successfull

  • @bhaimohsin
    @bhaimohsin 3 месяца назад +2

    3:53
    Register User:
    1. Get the data from req.body and check if all fields are present (ex: username, email, password)
    2. Check in the db, if a user with provided email is already present or not.
    3. If present, then return. If not, then proceed further.
    4. Create a new user in the db with provided details from req.body.
    5. Send a success message to client.

  • @TW-uk1xi
    @TW-uk1xi 9 месяцев назад

    Thanks for making this tutorial. please don't stop this series.

  • @chandrashekarv2397
    @chandrashekarv2397 4 месяца назад +1

    1.take all required values for registrering
    (if required,do validations)
    2.call the function which handle register user
    3.inside the function call the api to create user

  • @saketg07
    @saketg07 5 месяцев назад

    Awesome video for making any type of controllers

  • @atharvagholap1970
    @atharvagholap1970 2 месяца назад

    1) create a controller, 2) then a router with the controller function 3) use router in app. In controller we will need too take the values from the req object, save them in a variable, then validate and pass it to the database using the model

  • @LearnAlongFaizan
    @LearnAlongFaizan 9 месяцев назад

    Loved your style of teach, the way you look at things is awesome.
    ♥from Bangalore

  • @sayandotcom
    @sayandotcom 9 месяцев назад

    True sir. I appreciate your thoughts. I also think that real world projects are best to learn ❤

  • @snletwang6994
    @snletwang6994 5 месяцев назад

    1)get the user infomration in a format in json
    2)destructre them and assign them the key-names we used in out data cluster
    3)make an object of the data and passit to the db for storage
    4)Get the response back

  • @BhavinBhuva-y5h
    @BhavinBhuva-y5h 5 месяцев назад

    great explanation in on nod js and best channel...

  • @sandeshkumarchandrakar1622
    @sandeshkumarchandrakar1622 22 дня назад

    steps to follow while registerig the user.
    1. check for the presence of required attributes.
    2. check the uniqueness of some attributes(depends on the schema design).
    3. if some files are in the pic do multer + cloudinary and store the details [URL, publicId(needed while deleting ig)]

  • @nitinduke
    @nitinduke 3 дня назад

    learning alot from you sir

  • @devanand4269
    @devanand4269 10 месяцев назад

    Thanks sir amazing video .. Feeling confident please continue this series and stay motivated❤

  • @Dev-Phantom
    @Dev-Phantom 6 месяцев назад +1

    finale is coming closer. Best lecture ever

  • @spdwivedi5925
    @spdwivedi5925 5 месяцев назад

    In depth video sir , thanku

  • @herambsharma5879
    @herambsharma5879 5 месяцев назад

    1)extract info from the user
    2)then we check if all data fields are passed or not
    3)then we check if a user with same credentials exist or not
    4)if exist then display user already exist
    5)if not, then register the user in database

  • @powercircuitacademy
    @powercircuitacademy 10 месяцев назад

    Amazing series❤🎉sir

  • @KunalD1259
    @KunalD1259 2 месяца назад

    the best tutor and tutorial

  • @SoulofBuddhas
    @SoulofBuddhas Месяц назад

    Thank you sir amazing explanation

  • @physicsxcosmos1732
    @physicsxcosmos1732 9 месяцев назад

    1. first the user send the data
    2. then we have to take the data from body
    3. check if all required fields are available or not
    4. then in our regsiteration model we have to find the user if present in it then we return without registering the user
    5. if user not present we create the user in the database
    6. We hash the password and create jwt tokens
    5. then we stores the data in the db

  • @hussainmodiwala
    @hussainmodiwala 9 месяцев назад

    1. take user data like fields those are required (name, email, password etc.)
    2. check if the data is valid or junk and follows our rules
    3. if valid data then write a query to save that in db

  • @san29sh
    @san29sh 11 месяцев назад

    Bahut kuch naya sikhne mila thank you

  • @rakeshbhetariya
    @rakeshbhetariya 9 месяцев назад +1

    In this video I feel I am learning backend maja aagay sir ❤

    • @chaiaurcode
      @chaiaurcode  9 месяцев назад +2

      Glad to hear that😊☕️

  • @maniishbhandari
    @maniishbhandari 6 месяцев назад +1

    1. Ask the user Data from FE
    2. Access the data in BE
    3. check if all required field are given with correct format
    4. check if the user is already created
    5. if not create a new user
    6. send the user message that he has been created