r/programming • • Nov 28 '19

Node.js MySQL Crash Course | Node.js MySQL CRUD App

https://youtu.be/cfff2lQfXsw
0 Upvotes

4 comments sorted by

5

u/Booty_Bumping Nov 28 '19

Wow, this is bad. By the end of the video he literally has a textbook example of SQL injection.

I really hope no one is trying to learn best practices from these crap videos.

2

u/Dragasss Nov 29 '19

Sadly posts like this are the first ones to come up in search engines when you look for "language tutorial".

And nobody got the time to go page two.

Like right now im """""talking"""""" to a dude who doesnt understand that he should be reading C documentation and manpages to understand what why or how things work instead of looking at tutorials by pajeet ravshena.

At work, I have an intern who also insists on using Baeldung instead of that libraries documentation.

I blame easily accessible computing electronics for this.

2

u/Lfmars Nov 29 '19

Did you really expose an endpoint to directly create databases, tables and insert dummy data? You could teach how to make a CRUD web app using Node/ExpressJS without doing that sh*t. Just by creating the database/tables/data before, or using seed code, or using a code first lib to create it for you. But don't ever... ever... expose those things through your API.

I like that new content is being created, but please, make it good or don't do it at all. Learn the best practices before trying to teach anything. I mean, of course a a "crash course" is supposed to have some shortcuts... but what you did is not a shortcut.

2

u/Booty_Bumping Nov 29 '19

I imagine they have a background of being a PHP code-monkey, where (outside of sane parts of the ecosystem like laravel) it is common to have one .php file per page and to intersperse all sorts of backend logic and view logic, with all sorts of vulnerabilities all over the place.

In general, I have to wonder how code-monkeys like this think about code. When jQuery was ubiquitous there was a joke that jQuery is its own programming language, because you don't need to know a single thing about javascript to use jQuery at a basic level. So maybe the 2019 generation of code-monkeys think that

app.get('/addpost1', (req, res) => {

is a special syntax hard-wired into the language itself, and if you try to put logic anywhere else you will short circuit your computer and blue smoke will pour out.