r/programming • u/coderchrome123456 • Nov 28 '19
Node.js MySQL Crash Course | Node.js MySQL CRUD App
https://youtu.be/cfff2lQfXsw2
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
.phpfile 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.
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.