I need a help. So I made a login page which works fine when input is correct. But in case if the input goes wrong like either the password or username, it throws error and the server crashes. I don't want that. Instead I want that error to be handled someway but I ain't able to find any way. Please help me with this. I'd really appreciate if you can please.
I've gone through dozens of videos on this topic, I was finally able to get this going through this; you're very clear and concise. I mean, thanks to all the others for adding to my knowledge base, but it goes a long way to create a video where someone who can speak clearly and knows what they are doing, without wasting time. Thank you.
This is exactly what I think every time I want to learn something new. Brad is one of the few that is genuine, not overly and grossly enthusiastic, explains clearly, and is even funny at times which helps ease the learning process. He has a natural ability to make learning fun in this category.
Hi Brad, thanks for this video. I have a request in countinuation this video. I would be more than happy to pay for that course. A detailed course on Sequilize ORM for Node teaching basics of Sequilize and also Database Design using Sequilize. There are not much great resources on it and it would be great to have a course from you. Please consider this once :-)
Thank you Brad. Why is it that you seem to be the only guy on the internet who can explain things so that they're easy to understand, easy to implement and don't waste your time? You helped me so much (with your Udemy courses and RUclips videos) I cannot thank you enough. You rock :)
i regret not learning node backend development a few years ago, and sticked with laravel and codeigniter as the companies i was working for had projects in those. Thank you for this Brad. Your NodeJS Tutorials are very easy to get and understand. Thank You.
Was just building an express mysql2 api just for fun to practice and forgot how to use "?" for escape characters in queries to prevent sql injection. Fast forwarded to 17:30 and got my answer. Thanks TraversyMedia. I am now a professional web dev working on a contract with the DoD and your RUclips channel really helped me to become the web developer that I am today.
Great video. I was coming from mssql and had to find this specific video on how to link node.js with MySQL. Spot on. Thanks for the video, really helpful and well executed. Simple and easy, no messing around.
this is some of the channel on which i don't skip ads...for now this is the best i can do to help this channel. and i am commenting while that long ass ad is playing. :)
That's plenty. Thank you. I know ads really suck. I do the same thing though for all the creators I watch and enjoy. Especially if you are really liking the content and you just want to hurry up and skip. People like you are the reason I do this, it shows your appreciation and boosts my drive to create more free content :)
I tried your video using mamp. At first I couldn't access the db, but in the case of the mamp I changed the password to 'root' and it worked. I learned a lot.Thanks from Japan.
Those who are getting "ER_NOT_SUPPORTED_AUTH_MODE" error in the DB connection, try the newer NPM package "mysql2". It supports advanced authentication that MySQL 8.0 requires. Here's the NPM page link: www.npmjs.com/package/mysql2
don't know why people are using mongodb or postgre sql in tutorial of nodejs with expression. this tutorial simply show how to connect with database (mysql). it is very very helpful. thanks a lot.
I need a help. So I made a login page which works fine when input is correct. But in case if the input goes wrong like either the password or username, it throws error and the server crashes. I don't want that. Instead I want that error to be handled someway but I ain't able to find any way. Please help me with this. I'd really appreciate if you can please.
I need a help. So I made a login page which works fine when input is correct. But in case if the input goes wrong like either the password or username, it throws error and the server crashes. I don't want that. Instead I want that error to be handled someway but I ain't able to find any way. Please help me with this. I'd really appreciate if you can please.
This is really good. You know it oops at number one on the search... You really need to make an update on this... Its been six years now... You know many things must have changed overtime
Okay, so after a long day and a half, here's what I did to get this working. Hoping it helps anyone who struggled at it like i did. First, it's important to have your MySQL configuration set to legacy for password values as the connection from node kept throwing an error due to protocol mismatch. Once i reconfigured MySQL to the legacy, it finally connected. He doesn't cover installing Bash, so do an npm install bash after you install Terminal, then click the plus sign on the terminal to get the bash terminal. Once you do these things, following this tutorial is easy and does what it is supposed to do. Thank you
In ES6, when you have one function parameter, you can delete the parentheses which makes the code cleaner in my opinion :) db.connect( err => { if (err) { throw err } }); will still work.
Though one could argue that the parentheses shows clearly that it's a group of arguments, also it you want to use rest operator then you need to add parentheses. Sometimes you have to think how does it look to someone who's never seen your code and how easy is it to reason about your program. But I also prefer the cleaner look, but just wanted to show a reason why keeping it might be better, at-least if you are working within a team.
Wow, very informative, thanks! I watched this video to see if it would show me what I need to begin building a project, and it gives me what I need *and more*, so I'll definitely be rewatching.
I am using MAMP (not pro) and I had a hard time tracing the cause the error it was giving me when db.connect( ) runs. The solution I found was to enter the following argument into createConnection( ) : port: '/Applications/MAMP/tmp/mysql/mysql.sock', Hope this helps somebody! Also, Traversy, once beautifully concise video as always!
24:30 - line 87 - that's a nice candidate for SQL injection :)
7 лет назад+48
He is concatenating SQL query with string he receives from user request. So if user in that requests sends malicious SQL query it will get executed. This vulnerability basically allows you (as a hacker) to do anything with target database.
Fortunately you may use "Escaping query values": github.com/mysqljs/mysql#escaping-query-values So in this case the query may look like this: let sql = 'UPDATE posts SET title = ' + connection.escape(newTitle) + ' WHERE id = ' + connection.escape(req.params.id) +';
Really great video! I've twisted the code a little bit to send the results of the query to the screen like 'res.send(results)' for a better development experience! Thanks a lot
Hey Brad, love your work keep up the good stuff!! mabby in one of your future projects you can make a video on how to create and publish a react component library, would really like to learn more on that. Greets Julian
I need a help. So I made a login page which works fine when input is correct. But in case if the input goes wrong like either the password or username, it throws error and the server crashes. I don't want that. Instead I want that error to be handled someway but I ain't able to find any way. Please help me with this. I'd really appreciate if you can please.
I need a help. So I made a login page which works fine when input is correct. But in case if the input goes wrong like either the password or username, it throws error and the server crashes. I don't want that. Instead I want that error to be handled someway but I ain't able to find any way. Please help me with this. I'd really appreciate if you can please.
I LOVE your videos man! I'm getting comfortable with web technologies and your channel is really helping. Thanks for the videos! A request if you ever find time... Joomla as a Framework (not CMS)! Thanks again!
I need a help. So I made a login page which works fine when input is correct. But in case if the input goes wrong like either the password or username, it throws error and the server crashes. I don't want that. Instead I want that error to be handled someway but I ain't able to find any way. Please help me with this. I'd really appreciate if you can please.
@@hyperxjourney5837 Yeah thanks bro. I solved it. The problem was that when the program couldn't find anything in database the value coming back was null. So just used an if else statement and the problem was solved.
I need a help. So I made a login page which works fine when input is correct. But in case if the input goes wrong like either the password or username, it throws error and the server crashes. I don't want that. Instead I want that error to be handled someway but I ain't able to find any way. Please help me with this. I'd really appreciate if you can please.
Гоуем си, брат! (You are big one, brother (брат == brother, Brad is similar to Брат and sounds the same in my language - Bulgarian :) ) You are the best, really! Bless you! Have a great and lovely new year!
3 hours spend looking for an example of adding parameters at request, finally an example that works, really helpful
I need a help. So I made a login page which works fine when input is correct. But in case if the input goes wrong like either the password or username, it throws error and the server crashes. I don't want that. Instead I want that error to be handled someway but I ain't able to find any way. Please help me with this. I'd really appreciate if you can please.
00:00 Intro
01:40 Install XAMPP
03:09 Create app & Install dependencies
07:03 Create connection
08:12 Connect to MySql
09:30 Create database
12:36 Create table posts
16:56 Insert data to posts
19:58 Select posts
21:10 Select single post
23:05 Update post
24:55 Delete post
I've gone through dozens of videos on this topic, I was finally able to get this going through this; you're very clear and concise. I mean, thanks to all the others for adding to my knowledge base, but it goes a long way to create a video where someone who can speak clearly and knows what they are doing, without wasting time.
Thank you.
This is exactly what I think every time I want to learn something new. Brad is one of the few that is genuine, not overly and grossly enthusiastic, explains clearly, and is even funny at times which helps ease the learning process. He has a natural ability to make learning fun in this category.
True
Guys I apologize for the out of sync mini-cam toward the middle/end. I'm working on fixing that in my recording software. Hope you enjoy the video!!
Hi Brad, thanks for this video. I have a request in countinuation this video. I would be more than happy to pay for that course. A detailed course on Sequilize ORM for Node teaching basics of Sequilize and also Database Design using Sequilize. There are not much great resources on it and it would be great to have a course from you. Please consider this once :-)
just came here to press a like, u deserve it man :) good job
I will most likely do a youtube video but I am also considering a node.js course with a detailed project using sequelize
Thank you bud :)
Thanks
Thank you Brad. Why is it that you seem to be the only guy on the internet who can explain things so that they're easy to understand, easy to implement and don't waste your time? You helped me so much (with your Udemy courses and RUclips videos) I cannot thank you enough. You rock :)
no words for traversy media i cant imagine that much information in this duration very clearly explained hats off man from india
i regret not learning node backend development a few years ago, and sticked with laravel and codeigniter as the companies i was working for had projects in those. Thank you for this Brad. Your NodeJS Tutorials are very easy to get and understand. Thank You.
Was just building an express mysql2 api just for fun to practice and forgot how to use "?" for escape characters in queries to prevent sql injection. Fast forwarded to 17:30 and got my answer. Thanks TraversyMedia. I am now a professional web dev working on a contract with the DoD and your RUclips channel really helped me to become the web developer that I am today.
Every time I see this Traversy Media intro I know something good is coming...
Great video. I was coming from mssql and had to find this specific video on how to link node.js with MySQL. Spot on. Thanks for the video, really helpful and well executed. Simple and easy, no messing around.
this is some of the channel on which i don't skip ads...for now this is the best i can do to help this channel. and i am commenting while that long ass ad is playing. :)
That's plenty. Thank you. I know ads really suck. I do the same thing though for all the creators I watch and enjoy. Especially if you are really liking the content and you just want to hurry up and skip. People like you are the reason I do this, it shows your appreciation and boosts my drive to create more free content :)
I tried your video using mamp.
At first I couldn't access the db, but in the case of the mamp I changed the password to 'root' and it worked. I learned a lot.Thanks from Japan.
I was working on a project and was about to give up and this guy just made me not to.
Thanks bro
Those who are getting "ER_NOT_SUPPORTED_AUTH_MODE" error in the DB connection, try the newer NPM package "mysql2". It supports advanced authentication that MySQL 8.0 requires.
Here's the NPM page link: www.npmjs.com/package/mysql2
Thanks!
thanks a bunch🙏
don't know why people are using mongodb or postgre sql in tutorial of nodejs with expression.
this tutorial simply show how to connect with database (mysql). it is very very helpful.
thanks a lot.
Very good tutorial. Some updates(2022) would be to use mysql2 instead of mysql, and to add a port (usually 8889) if you are using MAMP. Thank you Brad
Such a chill, to the point tutorial... absolutely brilliant, lots of love from confused front-end devs
Thanks Brad for consistently delivering awesome tutorials that are precise, packed with tons of meat and no fluff. Great stuff bruv
I need a help. So I made a login page which works fine when input is correct. But in case if the input goes wrong like either the password or username, it throws error and the server crashes. I don't want that. Instead I want that error to be handled someway but I ain't able to find any way. Please help me with this. I'd really appreciate if you can please.
You are the best web development teacher on RUclips. Thank You Sir
Looked everywhere for something simplified...you made it much easier..thumbs up!
I'm learning a lot of English and a lot of web development with this video. This was very useful, thanks a lot.
Really straightforward and clear from the beginning! Thank you for doing this video
I need a help. So I made a login page which works fine when input is correct. But in case if the input goes wrong like either the password or username, it throws error and the server crashes. I don't want that. Instead I want that error to be handled someway but I ain't able to find any way. Please help me with this. I'd really appreciate if you can please.
This is really good. You know it oops at number one on the search... You really need to make an update on this... Its been six years now... You know many things must have changed overtime
Congratulations, man. I am from Brazil and I love your tutorials.
finally have found the best explanation. And get the code too so i dont have to rewrite everything. Thanks
I have had problems with the update because of the ID of my table data, thanks 4 explaining it clearly 👌
Oh what an introduction. To be frank, I was almost giving up but this made my learning seamless and easy. I can now CRUD using node. Thanks
One of the few channels i have subscribed
Thanks for helping me with my web programming homework, hugs from Brazil!
Okay, so after a long day and a half, here's what I did to get this working. Hoping it helps anyone who struggled at it like i did.
First, it's important to have your MySQL configuration set to legacy for password values as the connection from node kept throwing an error due to protocol mismatch. Once i reconfigured MySQL to the legacy, it finally connected.
He doesn't cover installing Bash, so do an npm install bash after you install Terminal, then click the plus sign on the terminal to get the bash terminal.
Once you do these things, following this tutorial is easy and does what it is supposed to do. Thank you
This is the most helpful and easy-to-understand video. Thanks, brad.
Watched a few videos and this is definitely the best and easiest to understand and follow
In ES6, when you have one function parameter, you can delete the parentheses which makes the code cleaner in my opinion :)
db.connect( err => {
if (err) { throw err }
});
will still work.
Though one could argue that the parentheses shows clearly that it's a group of arguments, also it you want to use rest operator then you need to add parentheses.
Sometimes you have to think how does it look to someone who's never seen your code and how easy is it to reason about your program.
But I also prefer the cleaner look, but just wanted to show a reason why keeping it might be better, at-least if you are working within a team.
It does kinda throw me a bit when there is no parenthesis around the argument, no pun intended!
Dude, I’m a beginner but I love these videos. Big shoutout to the person for not blasting me out with intro music too’
Great video. all of the code works fine. It's Still relevant in 2023!
Love the practical nature of your videos.
Thank you man, you made me believe I can still do it..!
Nosql is so fun. Sql needs so much structuring beforehand
CREATE DATABASE IF NOT EXISTS will be more suitable example if the task is to create db from code
Wow, very informative, thanks! I watched this video to see if it would show me what I need to begin building a project, and it gives me what I need *and more*, so I'll definitely be rewatching.
I am using MAMP (not pro) and I had a hard time tracing the cause the error it was giving me when db.connect( ) runs. The solution I found was to enter the following argument into createConnection( ) :
port: '/Applications/MAMP/tmp/mysql/mysql.sock',
Hope this helps somebody!
Also, Traversy, once beautifully concise video as always!
thats a socket not a port
excatly what needed for my DBMS project ✍
24:30 - line 87 - that's a nice candidate for SQL injection :)
He is concatenating SQL query with string he receives from user request. So if user in that requests sends malicious SQL query it will get executed. This vulnerability basically allows you (as a hacker) to do anything with target database.
Fortunately you may use "Escaping query values": github.com/mysqljs/mysql#escaping-query-values
So in this case the query may look like this: let sql = 'UPDATE posts SET title = ' + connection.escape(newTitle) + ' WHERE id = ' + connection.escape(req.params.id) +';
thank you
Use parameterized query. blogs.msdn.microsoft.com/sqlphp/2008/09/30/how-and-why-to-use-parameterized-queries/
maybe better look like this:
let sql = 'update posts set title='+ db.escape(newTitle) +' where id='+ db.escape(req.params.id) + '';
Every project I can think of you have a video for thank so much for your hard work
For ones who had problem connecting with db, around 11:30, password could be just empty string instead of 123456
This video is still very useful!
Thanks, Travisscott Media!
I really liked this. I always refers to this MAN's videos ( Traversy Media) for Node, MySQL , Mongo..etc....
Thank youuuu ! couldn't figure how to show the output in my browser from MySQL/Node. Thanks a lot!!!
This is really very helpful I learned it so fast bcoz you taught it so well❤️❤️
You are really awesome bro ❤
Always you are my guru
Laravel and node I have learned from you 😍
To be honest you helped me understand express framework!!! Well done!!!
You explain these things well. Thank you very much.
Thank you Brad for this tutorial
LEGEND !! GOT ME MY JOB!
Thank you so much for your video. It was really helpful for me. I was having hard time in a web project. then your video saved my life.
Awesome!! Easy to understand, clear, and the best intro to understanding Node with mysql. thanks alot!!
Thanks alot. This was exactly what I was looking for!
one tip:
use err.message instead of err in console.error(), which throw specific error
Lots of thanks for providing such a good content :)
Really great video! I've twisted the code a little bit to send the results of the query to the screen like 'res.send(results)' for a better development experience! Thanks a lot
Thanks alot I'm from Iraq I'm follow your courses is the best continues
Thanks man, that's awesome I'm able to help people all around the globe :)
This is such an odd way to do it, but I get that you're trying to teach the concept.
Awesome stuff.
Thank you Brad :)
Thank you so much! This was a hugely helpful tutorial. Keep up the great work!
good content brad really enjoy your crash courses and your series thank alot brad
you are awesome sir your all videos always very helpful thank you
Thank You So Much Man as a Newbie this Video Changed my Life, Lots of Love Bro
very nicely & quickly explained
Hey Brad,
love your work keep up the good stuff!!
mabby in one of your future projects you can make a video on how to create and publish a react component library, would really like to learn more on that.
Greets Julian
Very clean and quick guide, thank you!
This was extremely helpful. Thanks for the tutorial.
finally this is the one ive been waiting for
Great!, i just got into node js and this is a good start for me . Thank you
Express makes this so much easier. I'm doing it without express just node and mysql and its just a pain in the ass.
Nice tutorial! Easy to understand & implement! Thank you!
I need a help. So I made a login page which works fine when input is correct. But in case if the input goes wrong like either the password or username, it throws error and the server crashes. I don't want that. Instead I want that error to be handled someway but I ain't able to find any way. Please help me with this. I'd really appreciate if you can please.
Brad, thanks so much for this video. It really helped me understand things easier.
I love your tutorials
Thank you Brad this is what i m waiting for
hey, I taking ur course on udemy full stack web development. good to see you here.
Thank you for being you 🙏🏻🙏🏻🙏🏻
thanks a lot man such a precise tutorial
Thanks a lot Brad, exactly what i was looking for. You are Super !
I need a help. So I made a login page which works fine when input is correct. But in case if the input goes wrong like either the password or username, it throws error and the server crashes. I don't want that. Instead I want that error to be handled someway but I ain't able to find any way. Please help me with this. I'd really appreciate if you can please.
I LOVE your videos man! I'm getting comfortable with web technologies and your channel is really helping. Thanks for the videos! A request if you ever find time... Joomla as a Framework (not CMS)! Thanks again!
This guy is king
Great tutorial,
Please make a video on authentication using node js and mysql
Good tutorial Brad.
great tutorial but consider using app.post, app.delete, app.put, etc too
thats a legit intro
Thank you for sharing your code...saved me a bout an hour of fiddling now I can just use it to teach my boss :D
I need a help. So I made a login page which works fine when input is correct. But in case if the input goes wrong like either the password or username, it throws error and the server crashes. I don't want that. Instead I want that error to be handled someway but I ain't able to find any way. Please help me with this. I'd really appreciate if you can please.
@@apurv5847 did you find out mate?
@@hyperxjourney5837 Yeah thanks bro. I solved it. The problem was that when the program couldn't find anything in database the value coming back was null. So just used an if else statement and the problem was solved.
Great tutorial !!! Explained really fast !!! Thx !!!
Thank you very much, I understood very quickly....
This was extremely helpful, thank you! Keep up the great work.
Hi and thank you for your awesome video tutorials, you are one of my most favourite tutors :)
+1
I need a help. So I made a login page which works fine when input is correct. But in case if the input goes wrong like either the password or username, it throws error and the server crashes. I don't want that. Instead I want that error to be handled someway but I ain't able to find any way. Please help me with this. I'd really appreciate if you can please.
Thanks for this. I have a new task that requires me to extract data from Observium's Billing table and push that to a NodeJS API endpoint.
Remember to always sanitizer input. Never use input directly in the query.
Гоуем си, брат! (You are big one, brother (брат == brother, Brad is similar to Брат and sounds the same in my language - Bulgarian :) ) You are the best, really! Bless you! Have a great and lovely new year!
It worked! Thanks!
Hi thanks for ur video helped me a lot !! :)
Thank you brad for another awesome video
THANK YOUUUUUUUUUUUUUUUUUUUUU YOU SAVED MY LIFE