Node.js + Express - Tutorial - Express-Validator and Express-Session (Validation & Sessions)

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

Комментарии • 225

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

    3 years later and this is still usefull. Thanks max!

  • @fragileglass9622
    @fragileglass9622 8 лет назад +3

    This is awesome. You're simplifying usually confusing topics in Express. I love Express for the kind of customization it offers. Add what you need, take out what you don't.

    • @academind
      @academind  8 лет назад

      +Derek Shanks
      Yes, I agree that this is one of the biggest strengths of Express. And I really like it a lot because of this, too. Great to hear you're enjoying the videos :)

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

    4 Years Later and this is still very helpfull, thanks!

  • @pearlni3133
    @pearlni3133 6 лет назад

    My English is not very good, but I have learned a lot. This course gives me the opportunity to learn Nodejs systematically. Thank you for your hard work! From China.

    • @academind
      @academind  6 лет назад

      Happy to read that Kun and thanks a lot for your comment!

  • @sunmustbedestroyed
    @sunmustbedestroyed 5 лет назад +31

    I had an issue with Express Validator that I solved with: npm i --save express-validator@4

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

      Can you mark this comment? It could help many people. :)

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

      ​@@jirisrytr6080 There is a change in express-validator since version 6
      it's now using something like
      const { check, validationResult } = require('express-validator');
      so that's why you need to rollback in order for this to work.

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

      Thanks, solved my issue

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

      Thank you!

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

      what a great comment

  • @B1TCH35K1LL3R
    @B1TCH35K1LL3R 8 лет назад

    Max, since I haven't had the opportunity of having your answers on Udemy when I post something on the courses feedback (hoping you can read this instead) I just wanna thank you for all the courses you give and the way you do it, you are by far the best online lecturer I've ever had. Keep on with the good job.
    Greetings and many thanks all the way from the big Mexico City!

    • @academind
      @academind  8 лет назад

      Thanks so much Farid, really amazing to read this and it means a lot to me! I'm very glad to hear that you're enjoying the courses! :)

  • @mayankraghuvanshi486
    @mayankraghuvanshi486 6 лет назад +1

    I just want to say......
    Amazing bro I love this channel.

    • @academind
      @academind  6 лет назад

      So awesome to read that Mayank, thank you very much for your support!

  • @It7Is7Charlie
    @It7Is7Charlie 8 лет назад

    Dude, thank you so much. You made this whole thing just extremely easy to understand, considering that I bumped into this video in total misunderstanding of how express sessions work.Too bad I can`t put"Like" more than once.
    Nice job!!:D

    • @academind
      @academind  8 лет назад

      Thanks so much Charlie, it's really great to hear you enjoyed the video! :)

  • @elementfayt
    @elementfayt 7 лет назад

    You are my hero! Been learning node js on my own since Jan. and your videos help me so much. Thanks!

    • @academind
      @academind  7 лет назад

      Awesome to hear that, thanks so much!

  • @1christian98
    @1christian98 6 лет назад

    Such a great teacher! This stuff is usually hard for me to learn, so I'm happy to have found this.

    • @academind
      @academind  6 лет назад

      Great to read that the video helps to make things easier for you Christian, thank you for sharing this!

  • @siddardhab
    @siddardhab 8 лет назад +4

    man these videos are awesome. really appreciate you taking time to do these

    • @academind
      @academind  8 лет назад +4

      Great to hear you're liking them Siddhardha! :)

  • @igordacostapaschoalvidotto8632
    @igordacostapaschoalvidotto8632 8 лет назад

    One more awesome tutorial! Keep on doing this, please. Your channel will increase a lot, for sure. Thanks from Brazil.

    • @academind
      @academind  8 лет назад

      +Igor Vidotto Felipe
      I will, no worries. :)

  • @soudiptadutta6886
    @soudiptadutta6886 8 лет назад +1

    Indeed, a Very Good Tutorial friend.. Thanks from India

  • @RaulLopez-qd8cm
    @RaulLopez-qd8cm 8 лет назад

    you are a awesome teacher, im glad to have found your chanel, regards from El Salvador

    • @academind
      @academind  8 лет назад

      +Raul Lopez
      It's awesome to hear this, thanks so much Raul!

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

    great I got errors and listed them but If I want to show them under every corresponding field then how can I do that?

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

    I have a error coming. (expressValidator not a function).how will solve

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

      Ditto, I don't think this course is updated since this was posted in 2016. I would consider newer tutorial, since some of the newer npm package may have been updated which could introduce some breaking changes to the entire stack.
      Tried to look online for any clues on why but but not much effort.
      Only way to follow this tutorial correctly, is for Max to show his package.json file and download the exact version of the package that was used when creating this app as to no to run into some weird bug.
      But you could make it a learning opportunity, by trying to troubleshoot and see if you can find the fix, by going through a couple of the package update and readme, along with breaking changes.

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

      same error i also have pls post solution if anyone got it

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

      @@rishabhpatel1767 Fix here: stackoverflow.com/questions/12483554/not-able-to-use-express-validator-with-express-3-x
      in short just do command: npm i --save express-validator@4
      It's a version issue.

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

    For those of you having error like "
    TypeError: expressValidator is not a function" can degrade their express-validator version to remove the error?
    Type "npm i express-validator@5.3.1" in cmd

  • @giorgimerabishvili8194
    @giorgimerabishvili8194 8 лет назад +25

    Mad respect to you buddy!

    • @academind
      @academind  8 лет назад +3

      Thanks so much - I'm really happy you liked it!

    • @giorgimerabishvili8194
      @giorgimerabishvili8194 8 лет назад

      Thank you man! Where can I find more tutorials or blogs by you?

    • @academind
      @academind  8 лет назад +1

      I don't have a blog (yet) but this youtube channel + my Udemy presence (www.udemy.com/user/maximilian-schwarzmuller/) provide a lot of free and paid tutorials/ courses :)

    • @giorgimerabishvili8194
      @giorgimerabishvili8194 8 лет назад

      Thank you! You're truly awesome man!

    • @kartikchauhan5498
      @kartikchauhan5498 7 лет назад

      Hard work can easily be seen behind you videos. Kudos, man

  • @mikeb031
    @mikeb031 7 лет назад +1

    These videos are so helpful. You rule man.

    • @academind
      @academind  7 лет назад +1

      Really happy to hear that, thanks so much Michael!

  • @HelloMangkhala
    @HelloMangkhala 6 лет назад

    What's the hotkey you use @8:57 to hightlight and edit the same attribute value?

  • @coquifrog
    @coquifrog 6 лет назад

    Great video. I learned a lot. You are so positive and awesome. I love learning from you!

    • @academind
      @academind  6 лет назад

      Really happy to read that you like the content and the teaching style, thank you very much Paul :)

  • @miroslavspirkoski5623
    @miroslavspirkoski5623 7 лет назад

    These videos are awesome. Keep up the amazing work!!

    • @academind
      @academind  7 лет назад

      Thank you very much Miroslav, I'll try my best to keep it up!

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

    How to make the form preserve the data on failed validation?

  • @bluefoxaw
    @bluefoxaw 6 лет назад

    you're an allien mn,,,you teach laravel very well, node js very well,,,and i was afraid to learn em all..but i wanna be like youu
    ..i must know them all.

    • @academind
      @academind  6 лет назад

      Thanks a lot for this great feedback! But no worries, I'm not an alien, I guess I just enjoy learning new technologies :)

  • @Townsy
    @Townsy 6 лет назад

    Hey all i know this video is old so noone may respond but im getting this error when i refresh my page, i am up to 14:00 in the video and dont know why this is happening.
    If anyone has an idea let me know please, thanks!
    // Error Code Below //
    GET / 500 30.803 ms - 743
    _http_outgoing.js:481
    throw new ERR_HTTP_HEADERS_SENT('set');
    ^
    Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
    at ServerResponse.setHeader (_http_outgoing.js:481:11)
    at ServerResponse.header (D:\Coding\~JS\PureJs\First App\express-first-app
    ode_modules\express\lib
    esponse.js:767:10)
    at ServerResponse.send (D:\Coding\~JS\PureJs\First App\express-first-app
    ode_modules\express\lib
    esponse.js:170:12)
    at done (D:\Coding\~JS\PureJs\First App\express-first-app
    ode_modules\express\lib
    esponse.js:1004:10)
    at Immediate. (D:\Coding\~JS\PureJs\First App\express-first-app
    ode_modules\express-handlebars\lib\utils.js:26:13)
    at runCallback (timers.js:696:18)
    at tryOnImmediate (timers.js:667:5)
    at processImmediate (timers.js:649:5)

    • @Townsy
      @Townsy 6 лет назад

      I found out why, its cause i did: RES.session.errors not REQ.session.errors

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

    I am having error req.session.touch() is not a function
    Should I downgrade me express-session??

  • @mahmoudsayed2250
    @mahmoudsayed2250 6 лет назад +1

    i use ejs ... how i can convert each statement ?

  • @gyorgyszekelyi917
    @gyorgyszekelyi917 7 лет назад

    Excellent tutorial Max. Learned a lot ;)

    • @academind
      @academind  7 лет назад

      Really happy to read that, thanks so much for sharing this :)

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

    where is session part?

  • @george4746
    @george4746 7 лет назад

    Thanks for the video !
    I have two questions
    Q1 - How do i access errors for individual fields without looping ?
    Q2 - How do i pre populate form fields ?

  • @travel_ghost22
    @travel_ghost22 6 лет назад

    i am having an error route.get() requires a callback but got a [object undefined]

  • @gastikirs
    @gastikirs 8 лет назад

    If for example you are using Angular 2 you can make validations in the front end with data driven reactive forms. What is actually better? Doing it in the back end with express?

    • @academind
      @academind  8 лет назад +1

      You absolutely always need to validate on your backend. Frontend validation is nice to have and can improve UX but it also can be tricked (turn of JS for example). Therefore backend validation is super important to avoid getting/ storing invalid data

    • @gastikirs
      @gastikirs 8 лет назад

      Thank you! That was fast :)

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

    How to check email exitst? Please help me

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

    getting error, on app.use(expressValidator()); line, the error is "cannt use expressValidator as method". can anybody help me?

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

      Express Validator has been updated now you can can't use it this way This is the new way to use express validator express-validator.github.io/docs/
      Alternatively you can stay with previous version by running this commands
      npm uninstall express-Validator
      npm install express-validator@5.3.0

  • @mcsangveer
    @mcsangveer 7 лет назад

    Love your accent and of course you are a great teacher

    • @academind
      @academind  7 лет назад

      Awesome to read that you like both the content and the accent vignesh ;)

  • @ThunderBirdTHS
    @ThunderBirdTHS 8 лет назад

    Hi, I'm having trouble in the router.post function.
    During the if(error) the stack trace tells me it's undefined.
    If I put if(req.error) it seems to work, or at least not break.
    Not sure what I've done wrong.
    Thanks

    • @ThunderBirdTHS
      @ThunderBirdTHS 8 лет назад

      nvm I'm dumb

    • @academind
      @academind  8 лет назад

      Nah, I don't think so ;) Nonetheless, great to hear that everything seems to be working now!

  • @johncliffe
    @johncliffe 6 лет назад

    How do you get the colouring and autocomplete for handlebars?

  • @travel_ghost22
    @travel_ghost22 6 лет назад

    can anyone tell me how to use ejs with if and else in showing error messages

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

    Thank you for a great tutorial..!
    I tried to do this via pug instead of handlebars:
    if success
    section(class="success")
    h2 Successful validation!
    else
    if errors
    section(class="errors")
    ul
    each errors
    li this.msg
    But i got this error: malformed each..
    if i insted do this just to test:
    each e in errors
    li e
    it gives me:
    e
    e
    Because there is two error statements it gives me two e's. But it seems like it can't connect to the inbuilt this.msg and the two error statements using pug?

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

      I found the solution: since the error-msg are objects, we have to retrieve them like so:
      each val, ind in errors
      li #{val.msg} ... so instead of this.msg, we can also do val.msg ...
      Once again, thank you very much for this rich tutorial! looking forward to your course on udemy in near future..

  • @viralhighlights6588
    @viralhighlights6588 7 лет назад

    How's the "{{varName}}" thing called? Where you pass a json at res.render(renderView?, json, callback);

  • @lardosian
    @lardosian 7 лет назад

    Can indentation inconsistency break handlebars, was getting error on the form.

  • @akshaysoni2051
    @akshaysoni2051 7 лет назад

    Awesome Tutorial SIR :-)
    seriously loved it :-)

    • @academind
      @academind  7 лет назад

      So happy to read that, thank you so much akshay :)

  • @aniltheblogger
    @aniltheblogger 8 лет назад

    Oh man, u explained it so well...thanks a ton

    • @academind
      @academind  8 лет назад

      Thanks so much for your great feedback!

  • @redsnakeintown
    @redsnakeintown 8 лет назад

    So for some reason - My express is not able to load the stylesheet on the layout.hbs, I do see that the css file is loaded statically from the url directly.
    localhost:3000/stylesheets/style.css
    but the way I have applied it on layout.hbs is not working. Can you point out what could be the issue.

    • @academind
      @academind  8 лет назад

      Hm, looks good to me. The leading "/" is not needed though, but that shouldn't be the issue.
      I assume you're getting a 404 error in the JS console upon loading the page, right? Which URL is shown there?

    • @redsnakeintown
      @redsnakeintown 8 лет назад

      I get a basic html form displayed without any styling, no sure what is the issue, when the stylsheet is displayed from the URL : localhost:3000/stylesheets/style.css
      I have tried to put absolute path too but still not working, I have tried but none of them works

    • @academind
      @academind  8 лет назад

      Do you see any errors in your dev console? (Developer tools console)

    • @redsnakeintown
      @redsnakeintown 8 лет назад

      there were no errors in my console - but I finally figured out a lots of typos in the app.engine method. I guess a good IDE will avoid that but somehow VSCode didnt complain on those.
      My line was : app.engine('hbs',hbs({extname: 'hbs', defaltLayout: 'layouts', layoutDir: __dirname+'views/layouts/'}));
      defaultLayout was spelled wrong , also the I had set as layouts instead of file name as layout. I am able to fix it.
      Thanks

  • @abdulmoizsheikh8031
    @abdulmoizsheikh8031 7 лет назад

    Love your videos dude! Thanks!

    • @academind
      @academind  7 лет назад

      Thanks Abdul, so awesome to hear that!

  • @gangadharbc8820
    @gangadharbc8820 8 лет назад

    Nice!
    I have a doubt during the validation of empty password, initially entered email id clears and show the error message of only password field validation. Can you explain about it!
    Thanks in advance

    • @academind
      @academind  8 лет назад

      Sorry, I didn't quite get your question. You're not seeing all validation errors, is that it?

    • @gangadharbc8820
      @gangadharbc8820 8 лет назад

      @16.10 min,when you click on button to check for error message for password the email id will be cleared right, but during error message it will display only about password

    • @academind
      @academind  8 лет назад

      Ah okay - yes the old value gets deleted here. If you want to keep that, you would need to pass back the valid values to your view.

  • @amadrazo
    @amadrazo 6 лет назад

    Great TEACHER! Keep it up!

    • @academind
      @academind  6 лет назад

      Thanks a lot Alejandro, I'll try my best to do so!

  • @MrFitzpaddy
    @MrFitzpaddy 7 лет назад

    great videos! what is the best way to keep the form elements retain the values entered when there are errors? thx.

    • @MrFitzpaddy
      @MrFitzpaddy 7 лет назад

      This seems to work ok. Welcome any critiques! :)
      router.get('myRoute', function(req, res) {
      res.render('myView', {csrfToken: req.csrfToken(), success: req.session.success, errors: req.session.errors, data: req.session.data });
      req.session.errors = null;
      req.session.success = null;
      });
      router.post('myRoute', function(req, res, next) {
      .. do error checking...
      ...
      var errors = req.validationErrors();
      if(errors) {
      req.session.errors = errors;
      req.session.success = false
      req.session.data = req.body;
      } else {
      req.session.success = true;
      }
      res.redirect('myRoute'');
      }

  • @arrdee8558
    @arrdee8558 6 лет назад

    spent 3 hours trying to write the same index.hbs code in jade/pugjs and i still cant get it to work. im about to kms this is so frustrating

  • @pier-oliviermarquis3006
    @pier-oliviermarquis3006 7 лет назад

    Errors are always all undefined for me. I can access req.body.whateverfield but the check and checkbody do not work

  • @pj_jaswanth
    @pj_jaswanth 6 лет назад

    I got an error that "'errors' property is not defined".
    and the above line appears instead of sign up form

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

    I have tried addapting it to the new version of express-validator. I get an extra validation error that I am not sure how to fix.These are really my first steps with Express. I leave the code here in case is useful for someone. On index.js, at the top, import this: var {check, validationResult} = require('express-validator'); and the code for the post request at submit looks like this:
    router.post('/submit',
    [
    check('email').isEmail().withMessage('Invalid Email'),
    check("password")
    .isLength({ min: 4 })
    .withMessage('Invalid Password'),
    check("confirmPassword")
    .isLength({ min: 4 })
    .withMessage('Invalid Password Confirmation')
    .custom((value,{req, loc, path}) => {
    if (value !== req.body.password) {
    // trow error if passwords do not match
    throw new Error("Passwords don't match");
    } else {
    return value;
    }
    })
    ],
    function(req,res,next){
    var errors = validationResult(req);
    if (errors.array().length !== 0){
    req.session.errors = errors.array();
    req.session.success = false;
    }else{
    req.session.success = true;
    }
    res.redirect('/');
    });

  • @365rakesh
    @365rakesh 6 лет назад

    hello sir i am not getting the validation part

  • @nafishasnian1367
    @nafishasnian1367 8 лет назад

    Is it better to do the validations in Angular or in the Backend?

    • @academind
      @academind  8 лет назад +2

      I'd always do both. Angular 2 for UX, Backend for security. You can always trick the frontend (Angular 2) as it is JS. So in order to make sure that you're not saving invalid data in your database or something like that, also validate on the backend.

    • @nafishasnian1367
      @nafishasnian1367 8 лет назад

      That's an excellent point! I was thinking the same. Thanks again. But i have another question. How do you prevent XSS attacks in a MEAN 2 form?

    • @academind
      @academind  8 лет назад +2

      Angular 2 should automatically sanitize any HTML you output through some kind of databinding.

    • @nafishasnian1367
      @nafishasnian1367 8 лет назад

      Thanks

  • @venkateswarank1145
    @venkateswarank1145 6 лет назад

    I am little confused here.
    What is the use of session here.?
    What role does session play here..?
    How the successful validation page shows up without the form.?
    Any clarification would be highly appreciated

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

      watch quality content - there are many videos on this channel or similiar channels with high subscriber numbers but it's 90% bad content

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

    Which was the last video??

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

      You can find the full playlist here => academind.com/learn/node-js/the-basics/

  • @powerademonke
    @powerademonke 6 лет назад

    How come you're posting to '/submit' but the url that you're posting to is '/'?

  • @AbdSab193
    @AbdSab193 6 лет назад

    But this is better to be done by the client side ?

  • @binodgope8470
    @binodgope8470 6 лет назад

    hi sir, I am getting this error while starting the server. As installtion done successfully.
    const { checkSchema, validationResult } = require('../check');
    ^
    SyntaxError: Unexpected token {
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:387:25)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)
    at require (internal/module.js:20:19)

  • @elvin33321
    @elvin33321 8 лет назад

    I had to Subscribe because you are the coolest dude thank you!!!

    • @academind
      @academind  8 лет назад

      Haha, so amazing - thanks so much Elvin! :)

  • @youssssef
    @youssssef 8 лет назад

    Hi Max ,
    When I add any of these :
    req.session.errors = null;
    req.session.sucess = null;
    the server stops and I have a "Can't set headers after they are sent" error
    Anyway the code works if I removed them but I don't know why does this happen and what is their importance then.

    • @academind
      @academind  8 лет назад

      Do you maybe call res.render() before setting that?

    • @youssssef
      @youssssef 8 лет назад

      Yes exactly the same way in the video and here
      github.com/mschwarzmueller/nodejs-basics-tutorial/blob/master/08-validation-sessions/routes/index.js
      Is there a problem with that ?

    • @academind
      @academind  8 лет назад

      No, as res.redirect('/') gets called after that it should work fine. But the exact same code gives you this error? :/

  • @sydth2516
    @sydth2516 8 лет назад

    How do you output the errors below the specific input?

    • @academind
      @academind  8 лет назад

      You would need to conditionally render a (for example) in your template where you check if the input above the has an error. That in turn can be checked on the errors you get back from the validator. Also have a look at this link to learn more about the format of the error messages: github.com/ctavan/express-validator#validation-errors

  • @itsban
    @itsban 8 лет назад

    Thank you man! I needed this :D

    • @academind
      @academind  8 лет назад

      Awesome to hear you enjoyed it Esteban!

  • @khondakarreadulislam6337
    @khondakarreadulislam6337 7 лет назад

    Wunderbar.. Ich mag es sehr. Mega geil

    • @academind
      @academind  7 лет назад

      Das freut mich sehr :)

  • @saradaprasadmidde8047
    @saradaprasadmidde8047 7 лет назад

    Brother pl help ! express session is working in postman, but not working in browser. but session is being set in browser. am I making any mistake ?

    • @LOOTS243
      @LOOTS243 7 лет назад

      He said NodeJS sets the cookie on the server in memory.

    • @saradaprasadmidde8047
      @saradaprasadmidde8047 7 лет назад

      Thank you. Lets see after setting the cookie

    • @LOOTS243
      @LOOTS243 7 лет назад

      Sarada Prasad Midde ...but you can install other modules if you want to store on the server.

  • @mustafasimsek4658
    @mustafasimsek4658 7 лет назад

    my views data is in a pug format. how can i use these if conditions there?

    • @AnimeshSinghweb
      @AnimeshSinghweb 7 лет назад +1

      obviously, you would had referred to the pug documentation.

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

    Hi Max, any ideas on how to implement session renewal in express ? Thanks.

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

    Error: Failed to lookup view "error" in views directory

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

      this is an expressjs error, put
      app.set("views", "./views");
      after the line - const app = express();

  • @gerutz
    @gerutz 8 лет назад

    Max! While I send the form request via Post in this excersice, the page stay "waiting for localhost"...is extrange the example in the past excersice (get -post whitout express-valiator/sessions) works fine. Any clue??? As always thanks!

    • @academind
      @academind  8 лет назад

      Hard to tell - did you compare your code to mine (you can find a link to it in the video description). Maybe some infinite loop you're entering.

    • @gerutz
      @gerutz 8 лет назад

      Done, I want finised the error handler in the controller :) Works !!! Thanks again and I enjoy watching ads before your tutorials!!! ;)

    • @academind
      @academind  8 лет назад

      Great to hear ;)

  • @abhishekmalik4110
    @abhishekmalik4110 7 лет назад

    Thanks Max!, really helpful

    • @academind
      @academind  7 лет назад

      It is so great to read that I could help, thanks so much Abhishek!

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

    I was getting "cant find the error in views" error and when I fixed it I kept getting Get 500 on my console, I still dont know why.

  • @matteovelludini5435
    @matteovelludini5435 6 лет назад

    Hi, i have a question. What do you think of writing req.session.success = !errors outside the if using truthy values in js and writing 1 row less? is it a good practice or not?

  • @subbuvenkat9229
    @subbuvenkat9229 7 лет назад

    Sir,
    Is there any function like Laravel dd( ) in Nodejs(express.js )?

  • @boiii9793
    @boiii9793 6 лет назад

    max , why not use client side validation ?

    • @academind
      @academind  6 лет назад +1

      Doesn't suffice, users can bypass it (e.g. turn off JS, manipulate your code).

  • @curiousprogrammer90
    @curiousprogrammer90 7 лет назад

    Perfect! Thanks Max.

    • @academind
      @academind  7 лет назад +1

      Thank YOU Nikola, happy to read that you like it!

  • @zeroday4661
    @zeroday4661 8 лет назад +1

    can i ask u something?why u send the errors with session ?can we send it with render object?like res.render('home',{msg:errors})

    • @academind
      @academind  8 лет назад +2

      Yes, you could also do this, however I try to only send data via render() which is always there. That might not be the case for errors.

    • @zeroday4661
      @zeroday4661 8 лет назад

      Mindspace thanks u my idol

  • @DavidJohnson-hb6gh
    @DavidJohnson-hb6gh 5 лет назад

    Great video!

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

    I guess this channel values quantity more than quality

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

      What? Sorry but this is a really insulting comment considering the fact that you get more than 500 high quality videos for free here.

  • @dante8728
    @dante8728 8 лет назад

    Dude I love your tutorials!
    Just a small question: after following ur tutorial all works good, except that is not reading the elements inside the HEAD TAG , nor reading for example: , They just read the .hbs files without slyling, so on.... what do u think is happening?
    Im saking you this cause in this video I see u paste css style and automatically applies on the localhost... I download ur Repo Nbr 08, im comparing and is almost the same.. pls what do you think is happening? :) hugs!

  • @holgerkraus9665
    @holgerkraus9665 7 лет назад

    TOP! One thing: The link at the top "Possible session storages" is not correct!

  • @redsnakeintown
    @redsnakeintown 8 лет назад

    The screen text is making it hard to view the code sometime.

  • @engineersyedbabarali3777
    @engineersyedbabarali3777 7 лет назад +7

    What a beautiful smile on your face :-)

  • @bantzrayder8976
    @bantzrayder8976 7 лет назад

    I got lost on importing the styling. I thought you just copied a previous folder of which that particular styling was not included. Did I miss a step?

    • @lardosian
      @lardosian 7 лет назад

      Yes I just went into folder 8 on the repo and copied the css file.

  • @andregomezmercado1183
    @andregomezmercado1183 7 лет назад

    I don't understand why when I do put action='my method' it takes me to the URL instead of entering the method, I have followed all your tutorials up to now without any problems I don t get why this happens, help please.
    EDIT:
    After hours, for some reason I had characters problems.
    P.D
    Your tutorials are great

  • @russelldouglas5727
    @russelldouglas5727 8 лет назад +1

    What is the name of the style sheet used here and where on github is it?

    • @academind
      @academind  8 лет назад

      Github repo > 08-validation > public/stylesheets (github.com/mschwarzmueller/nodejs-basics-tutorial/tree/master/08-validation-sessions/public/stylesheets)

  • @henrybergstrom
    @henrybergstrom 6 лет назад

    What a great guide! One of the best on the web.
    How do you get ****** when you type in the password? Mine password fields comes with plain text.

    • @academind
      @academind  6 лет назад

      Happy to hear you're liking it. The *** is the default behavior if you set the to type="password" =>

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

    app.use(expressValidator()) is not working

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

      How did you solve this problem ?

  • @franciscoroca9444
    @franciscoroca9444 8 лет назад

    Hello my friend, to me it doesnt have too much sense to add the req.session.errors=null after the render on the 'get' request. it simply doesnt work.It makes sense to put it before to clean the errors when you refresh the page. If you put it after you are always going to get the error messages even when you refresh the page and the fields of the form are going to appear empty but the errors still there. But i still loving your videos :) Madrid

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

    sir plzzz make video on image validation using express validator

  • @niccubagonoc9907
    @niccubagonoc9907 6 лет назад +1

    I can finally go to sleep. Thank you!!!

  • @sushantkshirsagar
    @sushantkshirsagar 6 лет назад

    Thanks for the upload. That was so helpful. Are you using atom editor. And what is the package you installed for auto complete/auto suggestion of lib apis

    • @xCRSTx
      @xCRSTx 6 лет назад +1

      He is using webstorm or php storm

    • @academind
      @academind  6 лет назад +1

      Yep, exactly :)

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

    Those editor colors remind me of my first programming course in Turbo Pascal. Can you share the color codes in paste bin or something?

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

    For anyone having the "req.session.errors is undefined" error, you can write this work-around in routes/index.js inside the router.get function (although other solutions might be more elegant):
    if(req.session.errors) {
    res.render('index', { title: "Form Validation", success: false, errors: req.session.errors});
    } else {
    res.render('index', {title: "Form Validation", success: false, errors: ""});
    }
    For those using -ejs, this is the loop I use to print the errors:

  • @tituspullo3946
    @tituspullo3946 7 лет назад

    Thanks for this tutorial. I have followed some of your Python courses as well and appreciate your teaching style. There is something very confusing with this tut though. You install 'express-validator', but you are instead referencing the 'validator.js' module for chaining onto checks. Both are linked in the description. Which one is correct? The 'express-validator' module unfortunately doesn't have a clean and concise list of checks in its documentation, like the module you reference.

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

    Now its modified please tell the new one

  • @codefriendly8528
    @codefriendly8528 6 лет назад

    thank You So much for these videos....!
    Please Uplode Video on node pagination.

    • @academind
      @academind  6 лет назад

      Happy to read that you like the videos Osama! I might create more Node content in the future, thanks for the suggestion.

  • @manjunathr2330
    @manjunathr2330 7 лет назад

    Hi Man,
    With zero knowledge on front end, i learnt something from this tutorial ...
    Thank you
    May i know your name ..??
    you haven't mentioned anywhere in this tutorial ...

    • @academind
      @academind  7 лет назад

      Thanks so much for your wonderful feedback Manjunath, really happy to read that you liked the video. I'm Max :)

    • @manjunathr2330
      @manjunathr2330 7 лет назад

      Actually i'm stuck in a situation where i need some suggestions from you ,,
      here in our project where i'm working , the complete backend is built using nodejs , so i'm planning to build front end using nodejs ,, is my idea good..
      if yes how can i interact with api service built using nodejs from front end expreess ..
      if you didn't get my point ,, please feel free to ask me ..?
      I need your help Max ..?

  • @lucalanari6816
    @lucalanari6816 6 лет назад

    Hi! Great Video!
    I have a question, is there any client-side validator for express js?

    • @academind
      @academind  6 лет назад

      Not really - you can use any JS validation library though.

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

    good.. thanks guys >>>> god job

  • @tonniewhiteley2497
    @tonniewhiteley2497 6 лет назад

    You are awesome!

    • @academind
      @academind  6 лет назад

      Thank you so much Tonnie - you and all the other viewers are, you make the channel what it is :)