NodeJS REST: How to Refactor Code into Multiple Files with Router (Ep 4)

preview_player
Показать описание

Podcasts Course

Intermediate Training Core Data

Instagram Firebase Course

Facebook Group

Completed Source Code

Рекомендации по теме
Комментарии
Автор

Almost two years later and your videos are still teaching people to code. The refactoring was super cool, because I have never understood the logic behind it and you explained it extremely well. Congrats man and thank you for making such an awesome video, and taking the time to explain to us newbies!

nopa
Автор

Best series so far. This is next level. Thank you, Sir.

Daniel-szlq
Автор

Brian thumps up to you in this series honestly any body who wants to learn the basic of node js just need to watch this series everything else will be common sense.. thank you a lot for everything swift and now node js

ShenderRamos
Автор

The expert tip on the pool creation in stead of making a new connection every time to the mysql database solved my app crash on heroku... thanks a lot for your useful videos!

wimveldhuis
Автор

Thanks so much! That's exactly what I was looking for and struggling to find. On the spot!

AjaySingh-xdnz
Автор

Another cool video Brian, I watched you refactor and then did it myself. I went a bit deeper and moved mysql connection function to its own file. Again, thanks for the video.

Sam-lkci
Автор

I love this series, especially the way the tutor teaches.

tobiolotu
Автор

You are amazing teacher..!! Following you since your early days..Please continues this series with advance operations in Rest APIs.Thanks a lot

code
Автор

Thanks, Brian. your tutorials are quick and to the point.

akshayleads
Автор

Another fantastic video. Thank you so much Brian. If you get a chance, a tutorial with Firebase - Firestore with NodeJS would be epic. Salud!!

robmontesinos
Автор

Cant get enough of this series, amazing as always Brian thanks! :D

liamsutton
Автор

For everyone who asked how to register multiple routes, here some code for you to execute in app.js:
const fs = require('fs')
=> {

})
And as you will have to do sql queries in separate files in folder /routes, that doesn't contain variable mysql.createConnection, you may save it in global variable called "process", so your code block for connection to mysql will look like:
process.sql = mysql.createConnection({
host: 'xxx.xxx.gear.host',
user: 'somedbmysqluser',
password: 'mysqlpassword,
database: 'somedbmysql'
})
Hope it helps you! :)
P.S.
The most amazing tutorials, thanks man!

ppsq
Автор

It keeps getting better! Looking forward to the next video :D

Dennisvm
Автор

Very awesome, I would like if you make protected routes so unauthenticated users cannot use the app routes

ghanimalmarzouqi
Автор

Great introduce into nodejs API. Thanks a lot!

Автор

Nice video! Looking forward to Heroku. 🤓

ehorlyck
Автор

What if I want to split my routes into multiple files?


I was thinking of importing my router from routes/index.js and then import all the route files in index.js

angristan
Автор

Could you make a video explaining in details how nodejs is different from other languages for example the difference between sync and async operations and functions, and when callback functions should be used and when its ok not to use them?

micheldaoud
Автор

I like the branching out of stuff outside of IOS and android

decreer
Автор

Helpfull video, greetings from Argentina

zacsam