Build A Node.js API Authentication With JWT Tutorial

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

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

  • @wandilenxumalo735
    @wandilenxumalo735 5 лет назад +337

    I had to rewind that magic trick about 10 times. It made my day, thank you :D

    • @movinmove
      @movinmove 4 года назад +4

      playspeed 0.25 :D

    • @developerspoint6059
      @developerspoint6059 4 года назад

      Yeah it helps 😊

    • @manibharathy1994
      @manibharathy1994 4 года назад +1

      I did the same, with 0.25 speed

    • @gihanrangana6248
      @gihanrangana6248 4 года назад +6

      use like that
      const schema = Joi.object({
      name: Joi.string().min(6).required(),
      email: Joi.string().min(6).required().email(),
      password: Joi.string().min(6).required(),
      });
      return schema.validate(req);

    • @robinnatter8884
      @robinnatter8884 4 года назад +1

      @@gihanrangana6248 What do that

  • @MrVaffanci
    @MrVaffanci 4 года назад +516

    if you got this error -> "TypeError: Joi.validate is not a function" at min 29:00 or so, fix this by writing
    "schema.validate(req.body);" instead of "Joi.validate(req.body, schema);"

    • @TehBaconStrip
      @TehBaconStrip 4 года назад +161

      and setup the schema as: const schema = Joi.object({...});

    • @oyoyoyoyoyoy9479
      @oyoyoyoyoyoy9479 4 года назад +24

      I need to look at comments first next time)))

    • @ericbourne3116
      @ericbourne3116 4 года назад +41

      bro. BRO. i was stuck on that for fucking 3 HOURSSSS. FML. I had such a fucking headache. i was like whyyyy, WHYYYYYYY DOES THIS ONT WORK. you saved me, and my brain.

    • @AlifMunim
      @AlifMunim 4 года назад +5

      a true hero, thank you

    • @codefumble
      @codefumble 4 года назад +1

      you're a Godsend

  • @depthsofmindshorts
    @depthsofmindshorts 5 лет назад +232

    "Life is wonderful when things work." - DevEd, 2019

  • @ibosnfs1997
    @ibosnfs1997 5 лет назад +412

    People still spending money for bad tutorials, while you can find the best one on RUclips.
    Great tutorial! 👌🏻

    • @iercan1234
      @iercan1234 5 лет назад +2

      True.

    • @thangtea18bec
      @thangtea18bec 5 лет назад +7

      I agree with you.. His voice is so clear and explanation is very short and what i need that. If i need a full explanation i will look up into documentation

    • @Vietnamcamping89
      @Vietnamcamping89 5 лет назад +1

      Yep, this true

    • @janklager7085
      @janklager7085 4 года назад +1

      totally true

    • @blufrog9546
      @blufrog9546 4 года назад +1

      agree, u never get bored while following his videos

  • @pratikwadekar4981
    @pratikwadekar4981 4 года назад +6

    I already knew Angular and I was holding myself back from creating a MEAN Application. I wanted to get started by creating a basic application. I came across your Rest API tutorial and created one simple notes app using angular. Then I wanted to have authentication in my app so I saw this video and trust me you have kept it so simple as compared to other overrated tutorials out there.You are a life saver. Would've loved if you had a second part to this where you consume this API and create a front end for it.

  • @developedbyed
    @developedbyed  5 лет назад +457

    This one took a few energy drinks to make! Hope you guys enjoy it! I also left some timestamps in the description if you want to jump around or come back to the tutorial easily!

    • @sirlionellord
      @sirlionellord 5 лет назад +2

      Thx Ed

    • @ridl27
      @ridl27 5 лет назад +7

      very useful content bro! but can you share the code with us please ?

    • @AnhPham-pf4cj
      @AnhPham-pf4cj 5 лет назад +1

      appreciate super like

    • @zimbolazimboola27
      @zimbolazimboola27 5 лет назад +2

      very usefuly but can you do a tutorial for mysql for us please ??? thanks dear

    • @Wael100
      @Wael100 5 лет назад +1

      Hi, Dev I would like to find a direct link for the code in the description if you don't mind :)

  • @hidayetelitok9392
    @hidayetelitok9392 3 года назад

    nearly all youtuber developer teachers teaching low or beginner levels developing but you are teaching like a expert an again thanks for your sharing I learned from you

  • @justinp.1543
    @justinp.1543 5 лет назад +140

    around minute 18:40 => is better to use a timestamps instead of putting a property date when you create a Schema, example: UserSchema = new mongoose.Schema({property:{ }}, {timestamps: true}). In this way it creates a createdAt and updateAt and it automatically updates it.

  • @oscarekstrand3453
    @oscarekstrand3453 3 года назад +2

    You are such a talented teacher. I'v been at University for 5 years and honestly, the "learnings/hour" in your content is making Uni look like a playground.

  • @ManjunathManja1227
    @ManjunathManja1227 4 года назад +103

    Things covered in this video:
    00:00:57 Introduction
    00:02:32 Setting up express
    00:08:12 Connecting to a database
    00:14:22 .env files
    00:16:39 Creating models in mongoose
    00:19:34 Registering a user
    00:25:40 Validation with Joi
    00:42:35 Hashing passwords
    00:48:53 Setting up the login route
    00:57:25 Adding jsonwebtokens to our auth
    01:03:25 Creating private routes with jwt
    Copied from the description.

    • @biigsmokee
      @biigsmokee 4 года назад +3

      @DevEd, if you put 0:00:00 Start in the description you will get hotspots on the video

  • @Ayoub_Himself
    @Ayoub_Himself 3 года назад +8

    For anyone struggling with the string length validation, you should use minLength / maxLength for strings rather than min / max which is for numbers

  • @zacharymeyer991
    @zacharymeyer991 5 лет назад +61

    Joi changed their documentation and you'll need to create the schema as such-
    const schema = Joi.object({
    // name, email etc..
    });
    and then you'll destructure the error as const {error} = schema.validate(req.body);
    hope this helps :)

  • @bssushmitha6534
    @bssushmitha6534 4 года назад +10

    I must say, this is the best tutorial I have ever seen for explaining about JWT tokens. Honestly, by watching this video, I learned more than what they taught in the Bootcamp. I became a huge fan of you, DevEd. Your explanation is so so good. The jokes you make in between helps people a lot for not getting bored, and to concentrate more. The end is: I started loving your tutorials.

  • @christossotirlis2247
    @christossotirlis2247 4 года назад +3

    The thing with all these guides in here, is that people never explain how to use different packages and libraries together. You are the one who explains them and also combine them in a way other people will use them in real life. I am kinda new in Js and most things don't actually fit together just by doing random research. Thank you. I really hope you do a tutorial with mysql DB for people like myself who are new in this and mysql is the first step in dbs

  • @aris.konstantinidis
    @aris.konstantinidis 4 года назад +5

    After two udemy courses, endless stackoverflow reads and about twenty youtube videos on jwt, I have to admit that I never saw such a clear (hands-on) explanation as this one --> 56:19. Thank you a ton Ed!

  • @AaronJack
    @AaronJack 5 лет назад +6

    Hey Ed! Glad you're not completely burned out of development videos 😄thanks for inspiring people, you inspired me to start creating similar videos too!

  • @Sonuyadav-ie5fb
    @Sonuyadav-ie5fb 3 года назад +2

    whenever I watch his videos he always put smile on my face. He is one of the best teacher for programming available on youtube!

  • @shubhamingale110
    @shubhamingale110 4 года назад +42

    Hello,
    For new version of Joi,
    "Joi.validate(req.body, schema); " throws error.
    The solution is:
    "const schema = Joi.object({
    name: Joi.string().min(6). required (),
    email: Joi.string().min(6). required (),
    password: Joi.string().min(6). required ()
    });"
    Then in post route:
    "
    const validation= schema.validate(req.body);
    res.send(validation);
    "
    this will solve the error...

    • @elihergiorgana3559
      @elihergiorgana3559 4 года назад +3

      thank you :)

    • @syedhuzaifaali5322
      @syedhuzaifaali5322 4 года назад +1

      helped a lot thank you :)

    • @ujjwalbiswas8400
      @ujjwalbiswas8400 4 года назад

      Hey buddy, can you help me with this? "message": "\"name\" failed custom validation because Cannot read property 'presence' of undefined",

    • @vic-pm3rm
      @vic-pm3rm 4 года назад

      thank you, buddy, I just posted a comment that I had this problem but then I found your comment. When I tried it, it was working. I really thank you.

    • @vic-pm3rm
      @vic-pm3rm 4 года назад

      and what about at 36:43? im just not an expert at node.js

  • @gabrielartiola3721
    @gabrielartiola3721 5 лет назад +1

    It's my first time using node.js, mongodb and everything discussed on this video and i find it very easy, and it's because of you! Great tutorial, thank you! :D

  • @muktaryusuf6699
    @muktaryusuf6699 3 года назад

    I've watched a lot of tutorials that ended up confusing me more on NodeJS. But this right here, i the best i have come across.
    Seeing how you even explained what each operation does.
    You just init my backend career lol.
    Thank you

  • @JohnDoe-dz5wu
    @JohnDoe-dz5wu 5 лет назад +20

    Idk how randomly i found your channel but I'm glad i did... :)

  • @jesusredondo513
    @jesusredondo513 4 года назад

    I wish all tuts over Internet were this deep and condensed. This was pure gold. Thanks

  • @joooosh9432
    @joooosh9432 5 лет назад +24

    Literally one of my fav Tubers at the moment. Can't wait to see your success 😏

  • @shikhatripathi6731
    @shikhatripathi6731 2 года назад

    Best wishes n good blessings from India Dev Ed . I saw your previous videos of nodejs , now I can say that , yeah I am familiar with node-js . The concept of middleware was not clear to me but u made it very easy to me . All I want say that .....U are a savior n a very rare human being who have outstanding teaching capabilities .

  • @HiImKyle
    @HiImKyle 4 года назад

    I'm half way through this and all I can say is this is the better of the lot in terms of clear explanations and just overall goodness

  • @GGdevelopment
    @GGdevelopment 5 лет назад +33

    Can you do a second part to this? Like how to add the front end part? (like a login page, sign in, etc)...

  • @chadiusmaximus9350
    @chadiusmaximus9350 3 года назад +1

    great video. node and express is so much easier than any other language I've tried to learn back end on including python. thank you.

  • @georgekotsiopoulos6241
    @georgekotsiopoulos6241 4 года назад +3

    Hey, very useful video!
    A quick notice, min and max properties on the mongoose Schema should instead be minlength and maxlength respectively. The reason is that min and max refer to the exact values, number or date. Like if we have { min: 2 } an input of 3 will not be allowed. Instead we care about the length of the input and not the value.
    Hope that helps. Correct me if I am wrong.

    • @pemifo260
      @pemifo260 2 года назад

      Thanks for the information!

  • @jonathannadeau8679
    @jonathannadeau8679 3 года назад

    What I love about your videos is that you always start over from scratch. I think learning is repetitions so it helps me to remember informations better than the last time I watch one of your video! Thanks!

  • @skilled-person
    @skilled-person 5 лет назад +27

    As of npm 5.0.0, installed modules are added as a dependency by default, so the --save option is no longer needed

    • @developedbyed
      @developedbyed  5 лет назад +8

      Correct!

    • @skilled-person
      @skilled-person 5 лет назад +1

      @@developedbyed thanks for the tutorial you covered pretty much everything related to node :)

  • @quietcalm7299
    @quietcalm7299 3 года назад +1

    amazing video - the only update needed that I can see is Joi changed their syntax so now you need to write it the following way:
    const schema = Joi.object({
    email: Joi.string().min(6).required().email(),
    password: Joi.string().min(6).required(),
    });
    return schema.validate(data);

  • @jakubkoj1
    @jakubkoj1 5 лет назад +138

    Next part maybe create a front-end to this?

  • @MagnusPicard
    @MagnusPicard 3 года назад +1

    video 1:15 hours - my view time 4 hours - my script is running- Thank you so much doing the tutorial

  • @algife
    @algife 3 года назад +3

    Super complete tutorial that I will be recommending to my peers starting their dev careers!
    As feedback, would be great if you split the video chapters directly (I saw there is a an index of content by the minute in the description though. Informative and concise tut Ed!

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

    bro this is the most cleanest jwt video ive seen even after 4 years bro , thank u sooooooooooooooooooooooooooooooo much dude

  • @frankli2425
    @frankli2425 5 лет назад +4

    This channel is criminally under subbed. Keep up the good work, love your content!

  • @tambolaking5383
    @tambolaking5383 4 года назад

    This tut is beautiful. It chronologically tells me what all needs to be taken care of during setting up auth. I always used to get confused with the chronology.

  • @everbliss7955
    @everbliss7955 5 лет назад +8

    Hahahaha! That magic trick got me pumped up for the rest of the tutorial! Thanks, @Dev Ed. You are unique in an amazing way.

  • @rafaXD05
    @rafaXD05 3 года назад

    Finally this video came as a savior for me. Thanks Dev Ed 💖
    Also, if someone is watching in 2021, schema.validate() is the new function instead of Joi.validate()
    here is the code you might stuck at->
    //Register validation
    const registerValidation = (data) => {
    const schema = Joi.object({
    name: Joi.string().min(6).required(),
    email: Joi.string().min(6).required().email(),
    password: Joi.string().min(6).required(),
    });
    return schema.validate(data);
    };

  • @inamandev4389
    @inamandev4389 5 лет назад +6

    It would be a great FAVOR if you can do another VIDEO which help with UNIT TEST like how we can integrate UNIT testing using JEST for this login app OR any node app

  • @javierramirez798
    @javierramirez798 4 года назад +1

    I just wanted to say...Thank you so much! I finally understand how tokens are sent to the headers and are used. I've watched countless videos and read blogs, articles, and docs, none of them explained that particular part very well! Keep it up, dude!

  • @sina-qh8wm
    @sina-qh8wm 4 года назад +8

    The best auth tutorial ever...

  • @sharjeel_mazhar
    @sharjeel_mazhar 3 года назад

    If you don't know anything about RESTful APIs and you don't wanna waste precious time of yours then do not skip even a second of this video and you'll be just like me(who knew nothing how to code RESTful APIs) who can code RESTful APIs damn easily now💯💕
    Your time and efforts are much appreciated Ed!

  • @anuraghazra4772
    @anuraghazra4772 5 лет назад +61

    Hey dE.... Please extend on this topic and make one more video about implementing the frontEnd for this Auth API. Please😫🙏🙏💓

    • @deepneon
      @deepneon 5 лет назад +1

      Yes..it would be great if you teach us how to design the front-end for this.

    • @jormanfernandez8052
      @jormanfernandez8052 5 лет назад

      It would be awesome tho

    • @BodrumDrone
      @BodrumDrone 5 лет назад

      yeps we need how can i use nuxtjs SSR

    • @michrisoft
      @michrisoft 4 года назад +2

      TraversyMedia has one using JWT as well.

    • @ShikharSharma1398
      @ShikharSharma1398 4 года назад +1

      Good job on github-readme-stats :)

  • @secioreanuionelstefanita8687
    @secioreanuionelstefanita8687 3 года назад +1

    When I saw that Borsec bottle I knew this was gonna be the best tutorial I could find on the web , thank you so much ! :))

  • @liorocker1
    @liorocker1 5 лет назад +4

    Oh man, you don't know how much i've been waiting for this, such an amazing video with lots of fun code, BIG THANKS :)

  • @drlucky5474
    @drlucky5474 4 года назад

    Wow.... what can I say? Spending more than an hour and get the nice things I am looking for. Thanks and thank you very much. Simple but covers all. Great effort my bro....

  • @tobyboulton8340
    @tobyboulton8340 3 года назад +6

    Hello everyone. Due to the age of the video there is some changes with Joi which you will come to with the error Joi.validate is not a function" at min 29:00. First of all Hapi Joi is deprecated so you will want to npm install 'joi' instead. Also with creating the schema it will look like this: const schema = Joi.object({ .. as per video ..}); . Then validate the schema via const {error} = schema.validate(req.body);

    • @ventifan1018
      @ventifan1018 3 года назад +2

      const router = require('express').Router();
      const User = require('../model/User');
      //Validation
      const Joi = require('@hapi/joi');
      const schema = joi.object({
      name: Joi.string().min(6).required(),
      email: Joi.string().min(6).required().email(),
      password: Joi.string().min(6).required()
      });
      router.post('/register', async (req,res) => {
      //Lets validate the data before we are user

      const {error} = schema.validate(req.body);
      res.send(error.details[0].message);

      // const user = new User({
      // name: req.body.name,
      // email: req.body.email,
      // password: req.body.password
      // });
      // try{
      // const savedUser = await user.save();
      // res.send(savedUser);
      // }catch(err){
      // res.status(400).send(err);
      // }
      });

    • @RicardoDanyalgilJunior
      @RicardoDanyalgilJunior 3 года назад +2

      @@ventifan1018 You must needed to chage joi to Joi, with caps
      const schema = joi.object({
      name: Joi.string().min(6).required(),
      email: Joi.string().min(6).required().email(),
      password: Joi.string().min(6).required()
      });

    • @junior2441
      @junior2441 2 года назад +1

      @@RicardoDanyalgilJunior Thanks man!!

  • @batoulalsayyed1484
    @batoulalsayyed1484 2 года назад

    Thank you so much, I have an assignment due to tomorrow and couldn't understand how to do it, it is clear now !

  • @SelfDevTV
    @SelfDevTV 5 лет назад +5

    This video is a godsend. Exactly what I was looking for. Keep it up man :)

  • @ThiagoAdomaitis
    @ThiagoAdomaitis 3 года назад +1

    I love how Ed is funny withouth pushing it. He just is.

  • @sharonsegal1255
    @sharonsegal1255 4 года назад +7

    I smashed the like button so hard I cracked my screen - Thank you so much!

  • @ujjwaljain9780
    @ujjwaljain9780 3 года назад

    life is wonderful when things work.......Thanks for covering each topic so nicely

  • @LeaDClan
    @LeaDClan 5 лет назад +6

    Such good video topics for beginners. Going to watch this one now.

  • @qianbang_
    @qianbang_ 4 года назад

    This is all you need to learn rest API as a whole. Thanks for the video

  • @bakersentamu4725
    @bakersentamu4725 Год назад +4

    On 30:28, joi happened to update so it wont work as shown in the video instead use
    const schema = Joi.object({
    name: Joi.string().min(6).required(),
    email: Joi.string().min(6).email().required(),
    password: Joi.string().min(5).required(),
    });
    //and
    const validation = schema.validate(req.body);
    //in the router.post("/register") method

  • @adiletdaniyarov5737
    @adiletdaniyarov5737 4 года назад +7

    1:12:53 --> how to automate this action of adding that "auth-key" onto the header? Like if it is a real web app, how should a request be handled?

  • @dongus12
    @dongus12 3 года назад +1

    For those running in to a Joi.validate issue ~28:00, Joi.validate is no longer a function and instead you turn the schema object in to a const schema = Joi.object({username: blahblah...}) and then run schema.validate(req.body) instead of Joi.validate(req.body, schema)

  • @mucahitaslancan3282
    @mucahitaslancan3282 3 года назад +3

    New version of Joi there is not Joi.validate() . You should use schema.validate(req.body) 28:46

  • @cristiancr7954
    @cristiancr7954 2 года назад +1

    The best tutorial on internet, really simple and well explained!!!

  • @murillomfs
    @murillomfs 5 лет назад +6

    Really Nice work man! It helped me a lot to understand auth with json. Thanks.
    What about a frontend for this login, and if the user is valid, we redirect him to a page with the transition (using jsx, styled components, etc) from the last video.

  • @PetBuddies
    @PetBuddies 2 года назад +1

    Complete!!! God!!! you are a lifesaver dude!!! 4 years old video yet a super helpful and reliable channel for beginners like me!!! Liked, Shared, Subscribed and also presses the bell icon!!!

  • @ashutoshgupta450
    @ashutoshgupta450 4 года назад +4

    "Life is wonderful when things work."

  • @sumitsave8799
    @sumitsave8799 3 года назад

    Thanks Dev Ed this help me lot !!!!
    If anyone facing error at 29:00 as joi.validate() is not a function just type instead schema.validate(req.body) but before this create const schema = joi.object({...../*and create here validation schema*/....})

  • @aimanshamjafri9028
    @aimanshamjafri9028 3 года назад

    First of all, I love your energy. Make me more excited to learn. I plan of mastering node.js (express) to become a back end dev and secure a proper job. Wish me luck. Thank you so much.

  • @calvinbarajas5144
    @calvinbarajas5144 4 года назад +3

    if you end up sending the name, email, password from an actual HTML form (browser), you will need: app.use(express.urlencoded({ extended: true })) in the index.js file.

    • @ign_alpha
      @ign_alpha 3 года назад

      Can you show you you did this? I am trying to do this same thing but I have no idea how to implement my html file. gitrepo or contact me please g.jonathan252@gmail.com

  • @AbdulMoizAsif
    @AbdulMoizAsif 3 года назад

    best tutorial ever. Highly recommended to watch to clarify your concepts. Thanks Dev Ed

  • @BlackBastard815
    @BlackBastard815 5 лет назад +5

    Hi Dev i've a problem.. when i send the /register request from postman, the server stops at "await user.save()" (without any response).. (i think is a mongodb user problem... but i created also another account with reading and writing privileges..)

  • @muhammedadel9673
    @muhammedadel9673 4 года назад +1

    First, let me start by saying i appreciate the energy and effort into making these tutorials and sharing them for free that should never be taking for granted so thank you yet i was expecting it to be JWT focused since that's mainly in the title but you only start using it around 58:00 i do understand this topic involves a lot of boilerplate to demonstrate

  • @kevinskeldon1451
    @kevinskeldon1451 5 лет назад +8

    Great tutorial but having an issue saving to the database. Everything else works as expected, my db connection, user model is correct when logged to console, but if I add async and await it hangs then gives an error in postman. Do I need to manually create a collection in Atlas before? Any ideas, been trying to fix this for hours and getting fed up as followed this video word for word in my code :(
    try {
    const savedUser = await user.save();
    res.send(savedUser);
    } catch (err) {
    res.status(400).send(err);
    }

    • @aaronbrill616
      @aaronbrill616 5 лет назад

      Make sure your connection string has the correct username and password

    • @JohnGreen-qc5xb
      @JohnGreen-qc5xb 5 лет назад +2

      hi did u manage to figure this out, i am facing the same problem

    • @Sakonii_
      @Sakonii_ 4 года назад

      Try dropping the entire table from mongo and run again shell as:
      >> mongo
      db.dropDatabase();
      exit

    • @potatoondaflo
      @potatoondaflo 4 года назад

      im facing the same problem :(
      please help :(

    • @thatrafi5691
      @thatrafi5691 4 года назад

      me too help

  • @tannerbarcelos6880
    @tannerbarcelos6880 4 года назад

    You did an amazing job. I get this a lot better now! One thing I wished was that you’d explain more about what a middleware was more in depth. But, I’m in a web dev elective in my CS program right now so I kinda already knew!
    Needless to say, you did a killer job. You moved faster than a super slow beginning tutorial but not too fast that no one would understand.
    Thank you !

  • @vnrbhat
    @vnrbhat 5 лет назад +10

    Joi has changed the way of defining schema and calling functions. Checkout the documentation for further details.

    • @ricksondmanix3760
      @ricksondmanix3760 5 лет назад

      I would appreciate if you can let us know how is it done for the newer version with an example please?

    • @joaoolival4511
      @joaoolival4511 5 лет назад +3

      @@ricksondmanix3760
      const schema = Joi.object({
      name: Joi.string()
      .min(6)
      .required(),
      email: Joi.string()
      .min(6)
      .required()
      .email(),
      password: Joi.string()
      .min(6)
      .required()
      });
      router.post('/register', async (req, res) => {
      //VALIDATE DATA
      const validation = schema.validate(req.body);
      res.send(validation);
      });
      Its like this, just copy and paste - More info check hapi.dev/family/joi/?v=16.1.7

  • @valeedification
    @valeedification 4 года назад

    Thanks to you, I can now easily work as a MERN stack developer. Dev Ed you are a champ

  • @mhdyousuf3392
    @mhdyousuf3392 5 лет назад +8

    Please do MERN Stack. Thanks for the Content.. Helps a lot.

  • @uttamsharma3511
    @uttamsharma3511 3 года назад

    I was trying to understand jwt from long time because was not getting best video .
    but finally I understood what is jwt
    Thank you a lot 😊

  • @4541047
    @4541047 5 лет назад +4

    Thanks man :)
    Can you please publish the finalized code?

  • @ankitsanghi
    @ankitsanghi 5 лет назад

    This is easily the best video covering JWT I've ever seen. Super easy to follow and understand

  • @prosperarineitwe9147
    @prosperarineitwe9147 4 года назад +3

    Hey Dev Ed great tutorial. I would like some help implementing a logout function with the JWT

    • @8kelvin
      @8kelvin 3 года назад

      JWT is stateless, it seems cannot be logout from server side, @Dev Ed, could you please confirm..

  • @pratiksaria5830
    @pratiksaria5830 4 года назад

    I love the way u make Videos it's really relaxing and at the same time provides me knowledge. I have to say that there are few people i meet in my life journey of 20 who teaches so beautifully like you.Thank you for all you have done for the community

  • @_robyn_
    @_robyn_ 4 года назад +4

    0:08 watching this during corona lockdown belike :3

  • @deepakseervi9496
    @deepakseervi9496 4 года назад

    Seen a lot of tutorials, but none match your clarity of explanation. Keep up the good work:)

  • @johnconnor9787
    @johnconnor9787 3 года назад +4

    The new version of Joi requires validation to be written like this:
    const schema = Joi.object({ name: Joi.string() .min(6) .required(),
    email: Joi.string() .min(6) .required() .email(),
    password: Joi.string() .min(6) .required() });
    const validation = schema.validate(req.body);
    res.send(validation.error.details[0].message);

    • @keduslejiyared8701
      @keduslejiyared8701 3 года назад

      Yes this worked for me

    • @ShikaNiots
      @ShikaNiots 3 года назад

      im not being able to make it work when the validation is in another file, i can avoid any error returning schema.validate(data) instead of Joi.validate(data, schema), but its not actually apllying the validation. Any tip?

    • @johnconnor9787
      @johnconnor9787 3 года назад

      @@ShikaNiots maybe some issues with import/export statements of that file

    • @JaredAkers
      @JaredAkers 3 года назад +1

      @@ShikaNiots i was facing the same issue, got it to work with removing schema param from the return in the validation.js file using the updated joi documentation. e.g. "return schema.validata(data);"

  • @markkaranja11
    @markkaranja11 3 года назад

    I always like your videos because of how you kick them off, I'm usually serious when looking for such content and i highly appreciate you making me laugh!

  • @NhanNguyen-yf9cv
    @NhanNguyen-yf9cv 5 лет назад +7

    why not making a full project based course? I'm sure to be the 1st one who buy it ~~

    • @developedbyed
      @developedbyed  5 лет назад +5

      I will, it just takes a loong loong time to make and edit 😀

    • @perc-ai
      @perc-ai 5 лет назад

      @@developedbyed i will buy it

    • @NhanNguyen-yf9cv
      @NhanNguyen-yf9cv 5 лет назад

      @@developedbyed Would be very grateful if u could make something related to e-commerce/shopping cart from scratch (both the client and server) which is very in demand now. Other tutorials nowadays just suck as they give us many basic things and less real scenarios. They don't visualize the way to dive into these patterns as u do.

  • @daboos8
    @daboos8 4 года назад +1

    Great tut, he really has a way to breaking down things! I like that he focuses on the 'matter' on hand, and what doesn't and can waste time (like waste time making actual forms, he has other tuts for that that) and most importantly, like his other tuts, he puts all those concepts / libraries / tools into perspective allowing you to understand how they all relate.

  • @bibhushankarki9194
    @bibhushankarki9194 5 лет назад +29

    Good stuffs everytime 😍 do MERN videos too 😆😆😆

    • @JohannyLS
      @JohannyLS 5 лет назад +2

      I agree :D

    • @iHack-ms5nr
      @iHack-ms5nr 5 лет назад

      Absolutely fucking not.

    • @iHack-ms5nr
      @iHack-ms5nr 5 лет назад

      MEVN or MESN

    • @kattenelvis1778
      @kattenelvis1778 5 лет назад

      @@iHack-ms5nr Why do you hate React?

    • @iHack-ms5nr
      @iHack-ms5nr 5 лет назад +2

      @@kattenelvis1778 Can't stand it. The startup company I'm working in wanted me to write their microservices in React. I said I'd quit if they forced me to write React, so they changed their mind. I know use the MEVN stack on all their microservices, and the other developers on the team love me for that xd

  • @lucabaxter4002
    @lucabaxter4002 5 лет назад

    I know how to build an authentication system with jwt, but this is one of the best explanations i ever seen mate!

  • @maleksmida2464
    @maleksmida2464 4 года назад

    thank you, helps alot
    for those who faced a problem with "Joi" just add "Joi.object()" to the "schema":
    const schema = Joi.object({
    name: Joi.string()
    .min(6)
    .required(),
    email: Joi.string()
    .min(6)
    .required()
    .email(),
    password: Joi.string()
    .min(6)
    .required()
    });

  • @meujemeuje8721
    @meujemeuje8721 4 года назад +1

    @hapi/joi Chage so at 27:00 it's "const schema = Joi.object({//properties here})" and at 29:00 it's "const validation = schema.validate(req.body);"

  • @mikealejandro3938
    @mikealejandro3938 3 года назад

    I know you have to heard this once in a while dev, i love you, i'm learning to get a job partly because of you !

  • @Anstroy95
    @Anstroy95 4 года назад

    Dude I saw like 3 JWT tutorials before this one, but my face was like WTF! then I came here and I now have a very good understanding of it!!! thanks a lot!!!!

  • @fernandoflores8449
    @fernandoflores8449 4 года назад

    If anyone is having issues with connecting to the database, you need to first create a database and the collection on the mongodb page
    at 12:24 when he get the url it only appears the that needs to be changed into the user password, but in my case it also had a after the .net and there you have to put the name of the database you created, he used a database called test

  • @Isthiyaquekambathagothi
    @Isthiyaquekambathagothi 2 года назад

    Wow!! you explain things so seamlessly, feel great to learn things, so I hit that subscribe button, guess i will learn lot more on nodejs from this channel, love it

  • @Mo_sch2001
    @Mo_sch2001 3 года назад

    Best teacher ever (Simple,funny, efficient)

  • @lucasangelozzi9169
    @lucasangelozzi9169 2 года назад

    Loved the tutorial. The waterbreak 56:01 was very much needed. Great work!

  • @ventifan1018
    @ventifan1018 3 года назад

    OMG I have never ever learnt so much as I have done in this course wow So engaging, entertaining and full of useful information!!! Anyone reading highly RECOMMENDED!! Could you do tutorial where you build a basic like backend system that post stuff to like the front end :)

  • @frixaco
    @frixaco 4 года назад +2

    Finally I understood how to work with JWT! Thank you so much for this awesome tutorial!!

  • @prashantingwl
    @prashantingwl 3 года назад

    I love you bro ,
    started learning nodejs , after your rest api tut , binging on ur tuts .

  • @soufianebenchlih538
    @soufianebenchlih538 3 года назад

    Hey , this is wonderful and very helpful , Just an advice : if you ever wanted to tap a command and the server is lunching , you can duplicate the terminal ;)

  • @danielmarx1056
    @danielmarx1056 3 года назад

    Another awesome vid. Did the rest API yesterday, and this was a great follow up. Good job!