Node JS Tutorial for Beginners #28 - Middleware & Static Files

preview_player
Показать описание
Yo gang, in this NodeJS tutorial, I'll be showing you how we can serve up static files (such as CSS files) to the user using middleware. In this example, we'll use some middleware built into Express, which makes things super easy!

----- COURSE LINKS:

---------------------------------------------------------------------------------------------
You can find more front-end development tutorials on CSS, HTML, JavaScript, jQuery, WordPress & more on the channel homepage...

========== JavaScript for Beginners Playlist ==========

============ CSS for Beginners Playlist =============

============== The Net Ninja =====================

================== Social Links ==================

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

So for those who are confused, the first argument passed in the use function is basically saying that anyone who tries to access files inside /assets should be served with the files inside the "stuff" dir, which is the second parameter of the use function.
if you look at the link tag inside your html, it says "href="/assets/style.css"", here in this case you are trying to access the /assets folder, so then you are served with the files inside the stuff dir(which is indicated on the second param of the use function).

rubinluitel
Автор

i can't 'express' enough how helpful this is ... ty ...

nebojsaburgic
Автор

Your content alone surpasses many of the "bestselling" nodejs courses on Udemy relative to way and efficiency of explaining. I was able to understand and see the next method in action and its purpose whereas it other tutorials kept me puzzled.

tealleaf
Автор

Best explanation about middleware I ever heard! Excellent tutorials and teacher.

SA-ojbo
Автор

these tutorials are so good, that until the end you don't get why is taking all these middle step but in the end you get the whole picture and you are like okay this is the best teacher out there, keep on buddy!

artco
Автор

Best explanation I've found by far on how to serve static files, awesome

undeadretard
Автор

dude, you saved my day, i really appreciate there are these kinds of useful videos on youtube that could just solve our problems directly

zrmbbyl
Автор

You are the Man! You make my life really easy. I watched few channels but it is hard to understand the concepts of Node !! thanks heaps :)

ahmadsaqr
Автор

Thank you senpai, you don't know how much this tutorial helped. Both of these playlists are gold this and the new one as well. Kudos :D

kingindenorth
Автор

I don't comment on YouTube much but I am forever grateful to you for this (and I'm sure other) courses - you're actually helping me understand, not just "do" 🙏

tynsoltys
Автор

If you're having trouble with the profile css, just add a / right at the beginning of the CSS link e.g: "/assets/styles.css"

Rotouzi
Автор

Semplicemente chiaro, veloce e conciso. Ottimo !!!

backofloca
Автор

Now I get it fully understood the use of middleware. Thank you very much for a useful video. solved a problem for me.

UmutYerebakmaz
Автор

Extremely helpful. Keep up with the great content!

TrojanMouse
Автор

The best thing in you? You make things really very easy.

akashtyagi
Автор

very good explanation of middleware ♥ thank you

zakariachahboun
Автор

you're far away the best, dude!

levisimao
Автор

app.use('/stuff', express.static('stuff'))
When i used same string for both (stuff) it worked! my css file stored in stuff folder by the way.
So, use the same for app.use('/ ', express.static(' ' ))

abdussamad
Автор

Sean you should do a short video about your development career, ie what you do outside of yt, are you a freelancer, fulltime somewhere, what your position is and how you have evolved over the years. Im sure others would like to know as well, thanks in advance.

lardosian
Автор

Here I can't understand how does the css file gets served on '/' or '/contact' because we have mentioned route '/assests' for css file to run? If it serves this way then what is the use of '/assests'?

chintaldholakia
join shbcf.ru