Hey! I hope that you find the video useful. Do I have to zoom in more on the code and how is the audio? Don't forget to share the video with your friends, family and pets! Sub amigos y amigas!
Quick Update: The Body-Parser is no longer required as it has been re-added in Express.js. The code is more or less the same: // Parsing middleware // Parse application/x-www-form-urlencoded // app.use(bodyParser.urlencoded({ extended: false })); // Remove app.use(express.urlencoded({extended: true})); // New // Parse application/json // app.use(bodyParser.json()); // Remove app.use(express.json()); // New Also, I didn't use the connection pool correctly. The code should still work. I will update the article - link in the description.
Hey dude this is an incredible video. It would be great if you could do more Node, MYSQL videos where you explain more about what a pool is, for example. I'll look this stuff up myself but I just would like a better understanding of this stuff Thank you
Hi! Thanks for the comment. Unfortunately, I messed up the pooling connections bit. I didn't explain it well, and I didn't do it properly which has been bugging me. I am thinking of doing a similar video to redeem myself haha. There is a lot of room for improvement
outstanding teaching. mentioning mostly important points but if you try a little bit more to cover everything and feature regarding any vedio which you make, it will be owesome. By the way, i was searching for such guidance for few days
I appreciate the feedback friend, and I am glad that you found the video. I've put a lot of effort into the newish videos and I am trying to get better 😎👌
To display data in the browser there are quite a few options. I like to use the EJS or Handlebars templating engines. Then to make look everything nice you could do custom CSS or choose a library such as Bootstrap or TailwindCSS. I have a few tutorials on EJS, Handlebars and some of them use Custom CSS and some Bootstrap. Feel free to check out the Node.js playlist on my channel
@@RaddyDev Thanks for the reply, i think id didnt explain my need as wanted. Anyway i just find the answer, i installed an extension called JSON viewer. Hope that helps. Thanks again.
To make XMLHttpRequeats you could use the npm package called Axios. I think that I've made tutorials on it (check the nodejs playlist on my channel). Axios makes it super easy to do. Caching the queries is a tricky one to explain here. There are some great articles on Medium on that. I might look into doing a tutorial on that at some point. Thanks for the comment!
Thanks for this exemple but I would like to see, if you want to do, the same example with an index.ejs page in place of "postman" :) (excuse my bad english !)
@@RaddyDev How great, and what would it be like if I wanted to dynamically send a table name? My goal is to make a code that can be applied to all tables. I want to avoid a code for each table. My current system has more than 600 tables. Another thing: Would it be possible to send the entire clause to the API? In the case of a SELECT?
@@lcnebenzah I don't see a problem with sending a table name. You could do it with a drop-down, input or whatever suits your application. Wow 600 tables is a lot! Did you mean table rows? About the API, you could do that. I guess you will have to make a form and then post the select value - then use that value for the API. I think that the simple News website that I made with Node.js and express does that. I used an API and then posted different values to get a different output
@@RaddyDev Thanks for the answer. My system is complex, and there are 600 tables in mysql really. I am refactoring my system that is in PHP. This system started with Visual Basic based on Acess, then it was refactored in pure PHP in MySQL, then it was refactored in a platform called ScriptCase, which is PHP, but joins JS. Where it's been for 6 years and now I'm starting a refactoring for VUE. I forgot to talk about it, the way that the API will be consumed is through a VUE application.
Raddy, I got everything to work perfectly -thanks. Is there a way to hook up THIS code to a front end webform and do all the crud from an html form? I'm not sure how to apply this backend to a real webpage
I actually made a video on that: ua-cam.com/video/1aXZQcG2Y6I/v-deo.html Just read the pinned comment on top of the video when you get to the body-parser and the connection pool bit
Sir how can we do this, like lets suppose on frontend we have a section to add books for eg: book code and book name and their is a btn which will duplicate that book section so that we can add a second book and in this way we can add multiple books so we need to add column according to mysql table. how can we do this. another example: we are creating a single blog post and their we want to add some categories show the first blog post might have 10 categories and the second blog post might have five categories so how can we update our my square table accordingly.
For some reason I didn't see your comment. You could watch watch the user management video that I made or the new one where I build a simple recipe website. Both of them will show you the concept of how to create forms and submit some data. I assume that this is what you want to do
@@RaddyDev Sir I've watched that video and also implemented all those things which you taught us in that video, but I'm looking for something different, I'll send you a photo of what i want on Your Instagram.
Hey, it's not as easy as front end application, but it's not too hard. It's mostly just following a few instructions and usually, you can do it with the CLI which is not that scary. Give it a try. Heroku has a hobby tier that is free and they make it super easy to do. I actually have a video on that in the Node.js playlist. Have a great weekend and deploy! 😀
Hello Sir, I'm watching from the philippines and you have help me a lot, can you please make another video about this but connecting the NodeJs to fetch data from an HTML Form and also insert that data to the database? Thank you so much!
I am glad that you found the video useful. I do have one video in my Node.Js playlist that is using a form, but the video is fairly long as it's a full-on project. I will think about it, maybe I can do a short one
@@RaddyDev Thank you so much sir, i'm creating my capstone and unfortunately this wasn't even taught to us, It was really really helpful to me. More power to your channel Sir!
You need to make sure that you are installing the project in your folder. To do that make sure you "cd" to it in your command line / powershell. You can use "ls" to list the folders and "cd" to go backwards and forwards. Once you select your folder "cd project" then you can do npm init there
@@RaddyDev Thank you for reply! I've discovered that it was Unstable Version's fault, i have downloaded stable version of nodejs and it worked. Thank you!
There are a few ways of doing that. You could do something like SELECT EXISTS(SELECT * from ExistsRow WHERE id=77); Basically you can use the "exist" condition
I am making a tutorial on that right now. It's going to be a full CRUD application. To answer your question there are a few ways of doing it. You could create a page "delete-records" that grabs the data and removes it. Then your link could be something like this
This is not efficient way to query the database, you need to create a pool connection, and use the pool inside a route/controller. To use async await, you need to promisify your pool query and utilize the query into a functions so you can be able to share those functions as model through your server and avoid repeating yourself over and over. So, MVC will be a good approach.
you missed a trick at just before @22:00 LEAVE THE COMMENT IN - comments are so helpful to assist in the understanding - the more comments the better ! - thanks
At the point of recording the video, the body-parser wasn't included in Express. It's the same thing. I might need to put a note somewhere on the videos that you don't need to install the body-parser anymore
It might depend on the service that you are using. On Windows, I guess you could create a batch file that auto starts it. On Heroku, they have Node Heroku Client
This is the first time I have been able to work mySQL with Node I always had trouble...Mongo i never had an issue but mySQL meh.. Thanks a lot amd I really dont get it , why do the always play aroudn with body-parser, this see saw of includng and eexcluding it as a express function
Yeah I don't get it about the body parser. It's kind of annoying now haha. Glad that you where able to work with MySQL. It's quite nice and easy to get started I guess. I do like MongoDb and I need to explore it a bit more. Firebase is amazing, but I mainly use it with Angular
That's not a problem. Carry on from that point on the video. You basically need to do a routine... Just watch it from there and it will make sense. Also the code is on my blog, link in the description
@@jinyuchan3983 it's going to be your connection. You can reference the code from here: raddy.co.uk/blog/using-node-js-with-mysql-crud-xampp-phpmyadmin/ If you have any problems let me know. You can email me your code or join our Discord group :-)
@@RaddyDev no their is no any community post regarding this 😔i didi everthing perfect but its not counting real time moving numbers of subscriber 😔😔😔 highly appreciate if you teach how to do that❤
Ubuntu would be exactly the same as Windows. As long as you have XAMPP (or similar software) installed, you can run your database locally and use the same process
@@RaddyDev Hi I am trying to fetch with fetch('localhost:5000/') from different site I have followed the toturial to SELECT ALL part I ran to cors error I tried to fix that with cors library and it doesnt work ([nodemon] app crashed - waiting for file changes before starting...) I have tried const cors = require('cors') app.use( cors({ origin: "*", }) )
Help me please i have no idea now i got everything perfect but only sub counting in not working please tell me clearly how to do please or make one video
I liked your video because I got so much into Mongo that i left sql 2 years ago Your video helped to get back to track... Thanks and here is like, subscribe and Comment from me as a return
Es posible que pueda encontrar algunos tutoriales en español en UA-cam. No estoy seguro de si los subtítulos funcionan en otros idiomas sin traducirlos manualmente
With template literals you need to you the slanted single quotes. Like ` this `. Double quotes won't work there because of the dollar sign and the curly brackets. I hope this solves your problem, Rajhi :)
Bro, I'm Brazilian and I didn't find this content in Brazil. You helped me a lot with tanks, I wanted to enjoy it more than once.
I am glad to hear that you enjoyed the video. Thank you for watching!
Hey! I hope that you find the video useful. Do I have to zoom in more on the code and how is the audio? Don't forget to share the video with your friends, family and pets! Sub amigos y amigas!
Can you create another video on how to integrate this to the frontend/client side?
@@klydeguevarra9160 I can do yeah. I did do one which uses an API and EJS to render the pages. It would be fairly simular
please make more video on Node.js with MySQL
I will be posting a new one today. Thanks for the comment 👊🦍
Pets 😂
man you dont even know aft5er watching these vids for like 2 days BANGING MY HEAD!!!!!! THANK YOU SO MUCH!!!!!!!
Quick Update: The Body-Parser is no longer required as it has been re-added in Express.js. The code is more or less the same:
// Parsing middleware
// Parse application/x-www-form-urlencoded
// app.use(bodyParser.urlencoded({ extended: false })); // Remove
app.use(express.urlencoded({extended: true})); // New
// Parse application/json
// app.use(bodyParser.json()); // Remove
app.use(express.json()); // New
Also, I didn't use the connection pool correctly. The code should still work. I will update the article - link in the description.
Thanks Raddy
For those getting error on line 15 at 7:39 following is change :
app.listen(port, () => console.log("Listen on port %d",port))
Really straightforward tutorial, with a lot new techniques and methods to learn. Helped me so much with my uni project. You are awesome!!!
Great to hear! I hope that you are enjoying your time at university and thanks for the comment
Hey dude this is an incredible video. It would be great if you could do more Node, MYSQL videos where you explain more about what a pool is, for example. I'll look this stuff up myself but I just would like a better understanding of this stuff
Thank you
Hi! Thanks for the comment. Unfortunately, I messed up the pooling connections bit. I didn't explain it well, and I didn't do it properly which has been bugging me. I am thinking of doing a similar video to redeem myself haha. There is a lot of room for improvement
outstanding teaching. mentioning mostly important points but if you try a little bit more to cover everything and feature regarding any vedio which you make, it will be owesome.
By the way, i was searching for such guidance for few days
I appreciate the feedback friend, and I am glad that you found the video. I've put a lot of effort into the newish videos and I am trying to get better 😎👌
Nice video. It's helpful for beginners. Thank u very much ♥️ .from srilanka
Thank you so much Sir! Have a nice and wonderful life!
Same to you, friend!
thankyou so much your code on site helped me to connect the mysql i was tired to watch youtube videos but nothing was working.
I know the feeling especially if you try for ages or you need it done quickly. I am glad that you found the blog post helpful. Thanks for the comment!
Best video, Raddy! I want to use MariaDB in my project and any of the tutorials I followed did not work, until I tried yours :)
I am glad that the video was helpful! Thank you for the comment!
Super buddy! That was an awesome way with the explanation part for node.js crud operations basics.
Glad that you found the explanation easy to follow. Thank you for the comment!
Fantastic Tutorial !
Thank you!
great tutorial thanks
Glad you liked it
nice example. very simple, thanks
Glad you liked it!
That was simple and very efficient ...u helped me a lot ...thanks ♥️♥️
Big thank for this nice video
I have no friends or family member who is programmer, so i just liked and subscribed ... Is that okay???😜😜😜
No pets either? I will let you off this time
because you liked the video and subscribed. Thank you! 👊🦍
Thank you so much, saved a lot of time for me
You're welcome!
Very helpful, thank you so much!
Glad it was helpful!
Hi, Thanks for the video, i want to show data in the browser as it is shown for you, (it is shown but in a messy look), how can I do that ?
To display data in the browser there are quite a few options. I like to use the EJS or Handlebars templating engines. Then to make look everything nice you could do custom CSS or choose a library such as Bootstrap or TailwindCSS. I have a few tutorials on EJS, Handlebars and some of them use Custom CSS and some Bootstrap. Feel free to check out the Node.js playlist on my channel
@@RaddyDev Thanks for the reply, i think id didnt explain my need as wanted. Anyway i just find the answer, i installed an extension called JSON viewer. Hope that helps. Thanks again.
I misread it 🙂. Glad that you found a solution anyway
Very helpful ♥️♥️
Appreciate your commitment! Thank you
thank for the video, I have learned a lot, in spanish there arent so much infomration, I hope belong in a great programmer.
Glad to hear that! Maybe it's a sign that you start one. I am sure that you will become a great programmer 👊🙂
Excellent tutorial 🙂
Thank you!
Great video. How we can make with node and express XMLHttpRequest? and how we can cache sql queries with api? to avoid making multiple calls to the DB
To make XMLHttpRequeats you could use the npm package called Axios. I think that I've made tutorials on it (check the nodejs playlist on my channel). Axios makes it super easy to do. Caching the queries is a tricky one to explain here. There are some great articles on Medium on that. I might look into doing a tutorial on that at some point. Thanks for the comment!
Thank you so much raddy
Thanks for watching once again Anish! 😎
Thanks, Raddy!
Thanks for the comment, Ester!
Great vedio .Really enjoyed it. can you do a another vedio of how to do crud operations using form in node js using mysql
You are here just on time. The full crud video is coming out tomorrow. Thanks for the suggestion and comment 👊🦍
thank you it was Awesome
Glad you liked it!
I have a question, the app folder is in C:\xampp\htdocs?, i could't run the app with XAMPP
Have you started all services? Laragon is another alternative if XAMPP is not working for you
Thanks for this exemple but I would like to see, if you want to do, the same example with an index.ejs page in place of "postman" :) (excuse my bad english !)
I am definitely going to do a full CRUD page with ejs soon. Thanks for the suggestion and your English seems fine
Can I pass more parameters when requesting the API?
Like the name of the table, or the entire clause?
Yes, of course. You can pass as many parameters as you need
@@RaddyDev
How great, and what would it be like if I wanted to dynamically send a table name?
My goal is to make a code that can be applied to all tables.
I want to avoid a code for each table.
My current system has more than 600 tables.
Another thing: Would it be possible to send the entire clause to the API? In the case of a SELECT?
@@lcnebenzah I don't see a problem with sending a table name. You could do it with a drop-down, input or whatever suits your application. Wow 600 tables is a lot! Did you mean table rows? About the API, you could do that. I guess you will have to make a form and then post the select value - then use that value for the API. I think that the simple News website that I made with Node.js and express does that. I used an API and then posted different values to get a different output
@@RaddyDev
Thanks for the answer.
My system is complex, and there are 600 tables in mysql really.
I am refactoring my system that is in PHP.
This system started with Visual Basic based on Acess, then it was refactored in pure PHP in MySQL, then it was refactored in a platform called ScriptCase, which is PHP, but joins JS.
Where it's been for 6 years and now I'm starting a refactoring for VUE. I forgot to talk about it, the way that the API will be consumed is through a VUE application.
Hi Raddy. Can you please guide how to use joi validations here?
I could potentially make a video on it, but it's going to take some time
thanks boss ❤
thankyou brother
Amazing video thank you!
Glad you liked it! Thank you for watching
Great 👍
Thank you! Cheers!
Raddy, I got everything to work perfectly -thanks. Is there a way to hook up THIS code to a front end webform and do all the crud from an html form? I'm not sure how to apply this backend to a real webpage
I actually made a video on that: ua-cam.com/video/1aXZQcG2Y6I/v-deo.html
Just read the pinned comment on top of the video when you get to the body-parser and the connection pool bit
@@RaddyDev Thanks very much
oh man you save me thank u very much
That's awesome, Ali. Glad that you found it useful!
love from india
Thank you, my friend!
Sir how can we do this, like lets suppose on frontend we have a section to add books for eg: book code and book name and their is a btn which will duplicate that book section so that we can add a second book and in this way we can add multiple books so we need to add column according to mysql table. how can we do this.
another example: we are creating a single blog post and their we want to add some categories show the first blog post might have 10 categories and the second blog post might have five categories so how can we update our my square table accordingly.
For some reason I didn't see your comment. You could watch watch the user management video that I made or the new one where I build a simple recipe website. Both of them will show you the concept of how to create forms and submit some data. I assume that this is what you want to do
@@RaddyDev Sir I've watched that video and also implemented all those things which you taught us in that video, but I'm looking for something different, I'll send you a photo of what i want on Your Instagram.
Hi Raddy, how can I deploy this. Since, it's backend, I'm guessing it's not as simple as front end only applications?
Hey, it's not as easy as front end application, but it's not too hard. It's mostly just following a few instructions and usually, you can do it with the CLI which is not that scary.
Give it a try. Heroku has a hobby tier that is free and they make it super easy to do. I actually have a video on that in the Node.js playlist. Have a great weekend and deploy! 😀
very nice vid.
Thank you
Hello Sir, I'm watching from the philippines and you have help me a lot, can you please make another video about this but connecting the NodeJs to fetch data from an HTML Form and also insert that data to the database? Thank you so much!
I am glad that you found the video useful. I do have one video in my Node.Js playlist that is using a form, but the video is fairly long as it's a full-on project. I will think about it, maybe I can do a short one
@@RaddyDev Thank you so much sir, i'm creating my capstone and unfortunately this wasn't even taught to us, It was really really helpful to me. More power to your channel Sir!
Hello, im doing exact same but its not creating app in my folder, what may be the problem? i have node js installed on my machine
You need to make sure that you are installing the project in your folder. To do that make sure you "cd" to it in your command line / powershell. You can use "ls" to list the folders and "cd" to go backwards and forwards. Once you select your folder "cd project" then you can do npm init there
@@RaddyDev Thank you for reply! I've discovered that it was Unstable Version's fault, i have downloaded stable version of nodejs and it worked. Thank you!
thank you so much!!
Most welcome! Thank you for watching 👊🦍
Thank you !
Most welcome!
Hi.sorry I follow yours, but on my insert is not works Got failed in SQL synta.Can guide how to solve this problem. Thanks
Sorry to hear that! Yes, of course. It could be a silly typo. Is there any way you can show me your code?
Thank youuu!!
Thank you for watching! I hope that you found it useful
Awesome 👍
Thank you! 👊🦍
Glad i found this, keep it coming.
Awesome, I will do that! Thanks for the comment
how to check existing row by id then delete it in delete method
There are a few ways of doing that. You could do something like
SELECT EXISTS(SELECT * from ExistsRow WHERE id=77); Basically you can use the "exist" condition
How can we active the delete action in a Href ? Thank you !
I am making a tutorial on that right now. It's going to be a full CRUD application. To answer your question there are a few ways of doing it. You could create a page "delete-records" that grabs the data and removes it. Then your link could be something like this
This is not efficient way to query the database, you need to create a pool connection, and use the pool inside a route/controller. To use async await, you need to promisify your pool query and utilize the query into a functions so you can be able to share those functions as model through your server and avoid repeating yourself over and over. So, MVC will be a good approach.
That is true. I might need to do a follow up video. Thanks for the comment
Thanks
Thank you for watching!
you missed a trick at just before @22:00 LEAVE THE COMMENT IN - comments are so helpful to assist in the understanding - the more comments the better ! - thanks
why do you use body-parser?
why don't you express.json? isn't it the same?
At the point of recording the video, the body-parser wasn't included in Express. It's the same thing. I might need to put a note somewhere on the videos that you don't need to install the body-parser anymore
How to run node js service in background and auto restart on rebooting the server
It might depend on the service that you are using. On Windows, I guess you could create a batch file that auto starts it. On Heroku, they have Node Heroku Client
I constantly get the error Handshake inactivity timeout when I try to connect to the server.
Have a look at the answers here: stackoverflow .com/questions/35553432/error-handshake-inactivity-timeout-in-node-js-mysql-module
I hope this helps :)
This is the first time I have been able to work mySQL with Node I always had trouble...Mongo i never had an issue but mySQL meh.. Thanks a lot
amd I really dont get it , why do the always play aroudn with body-parser, this see saw of includng and eexcluding it as a express function
Yeah I don't get it about the body parser. It's kind of annoying now haha. Glad that you where able to work with MySQL. It's quite nice and easy to get started I guess. I do like MongoDb and I need to explore it a bit more. Firebase is amazing, but I mainly use it with Angular
bro i am having the trouble its showing the same error when we setup the connection
What does the error say?
@@RaddyDev actually it says cannot Get can please share your email so we ca n discuss it
That's not a problem. Carry on from that point on the video. You basically need to do a routine... Just watch it from there and it will make sense. Also the code is on my blog, link in the description
Reference error: connection not defined. line 28. Any ideas?
Did you define your MySQL connection? What do you have on line 28?
@@RaddyDev connection.query('SELECT * FROM beers', (err, rows) => {
@@jinyuchan3983 it's going to be your connection. You can reference the code from here: raddy.co.uk/blog/using-node-js-with-mysql-crud-xampp-phpmyadmin/ If you have any problems let me know. You can email me your code or join our Discord group :-)
@@RaddyDev thanks for the kind response~
if i have no password for mysql createpool what can i put for the password...
Leave empty or create password
@@RaddyDev thank you, and for create operation, iam getting an error like you have an error in your sql syntax.
If I've had an error I usually show how to fix it straight after
Can you create full web site Node.js with MySQL - CRUD (not with | XAMPP / PhpMyAdmin)but the real version of mysql and add html css
Using the MySql Workbench?
@@RaddyDev yes and add html, css
Olá!
🤠
I didi everything fine but it only shows 16000 but doest no count subscriber like 16686 what we can do for it??
Read their community post regarding that
@@RaddyDev no their is no any community post regarding this 😔i didi everthing perfect but its not counting real time moving numbers of subscriber 😔😔😔 highly appreciate if you teach how to do that❤
R.E.S.P.E.C.T. CHAD
😆😆
How to connect mysql with node js in Linux Ubuntu?
Ubuntu would be exactly the same as Windows. As long as you have XAMPP (or similar software) installed, you can run your database locally and use the same process
@@RaddyDev ok thanks a lot... 👍
Hi how can I fetch the data from this api ?
Which API is that? For fetching data you can use Fetch or something like Axios. They make it very easy to fetch data from an API
@@RaddyDev Hi I am trying to fetch with fetch('localhost:5000/') from different site I have followed the toturial to SELECT ALL part I ran to cors error I tried to fix that with cors library and it doesnt work ([nodemon] app crashed - waiting for file changes before starting...) I have tried
const cors = require('cors')
app.use(
cors({
origin: "*",
})
)
@Egel The cors implementation looks correct to me. Is there a specific error message that you get as it's hard to guess what it could be
@@RaddyDev update from me it was error on my end now it works I am glad you made this tutorial thanks
I am glad that you fixed it
i need to learn one to many, one to one and many to many relationship
Please make one video on live subscriber count real times
This video has nothing to do with Subscribers lol
Help me please i have no idea now i got everything perfect but only sub counting in not working please tell me clearly how to do please or make one video
woo another message!
Good
👌
Insert and Update is not working now
What happens? Do you get any errors? Debug as much as you can, I am sure that it's something small that can be fixed quickly
Just tweak the Header > Key: Content-Type Value: application/json in postman
this should display the json in the body now.
Лезги программист гадаяр авани ина?
Аз съм от Източна Европа 👍
@@RaddyDev Яда вун лезги яни? Къала са кьве гаф лагь лезги ч1алал чан бала
@@RaddyDev А так урок просто бомба, все четко и понятно 👍
@@abdullahshirinov3506 sorry I don't fully understand this
I liked your video because I got so much into Mongo that i left sql 2 years ago Your video helped to get back to track... Thanks and here is like, subscribe and Comment from me as a return
I am glad that you liked the video! Thank you for the sub and nice comment! 👊🦍
really bro? 50 minutes?
hello
Hello!
No se nimerga no entiendo ingles
Es posible que pueda encontrar algunos tutoriales en español en UA-cam. No estoy seguro de si los subtítulos funcionan en otros idiomas sin traducirlos manualmente
thank you for this video it helps me a lot but ""${[req.params.id]}"" is not read in source-code, if you can solve this problem.
With template literals you need to you the slanted single quotes. Like ` this `. Double quotes won't work there because of the dollar sign and the curly brackets. I hope this solves your problem, Rajhi :)
Thank you soooo much!!!
Thank you for watching!