How to Serve Static Files from a Node Server

preview_player
Показать описание
This tutorial explains how you can add the ability to serve static files to a basic node web server without using Express.

This Code GIST contains the node js file, as well as the HTML, CSS, and JS files that are being served.

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

I always like to try and resolve problems myself. However, it's really great to know I can get a very clear breakdown of a particular theme, including any useful options or supplementary features from your material. Thanks for your generosity in sharing this knowledge, it's very much appreciated .

colbr
Автор

ma favorite asmr js chanel
thanks for the knowledge

adammalec
Автор

Thank you for the content Steve. I admire your consistency.

charliex
Автор

Thanks for making the JS easy. I like how you provide solutions and explained it well.

kelvezu
Автор

This video of yours helped me solve the issue of why my CSS or my JS was not working!
This video saved my day!

ghostandgoblins
Автор

The explanations are on point and with such great details. You can't ask for more. Nice video. Thanks!

jeffreycaballero
Автор

That was very helpful, thank you. You successfully packed the concept and a practical example in a very short video. Thank you.

mohamedmabrouk
Автор

Thank you so much for the content. Had a hard time finding an example of how to serve JavaScript. This is exactly what I needed!

annasong
Автор

This is an amazing intro into web servers. Please keep uploading new content. Your voice is so soothing...

seasonsunite
Автор

A gain, I can't thank you enough, Thank you Steve.

mohamedmabrouk
Автор

Thank you very much. this was extremely helpful for me

robertshields
Автор

Thanks for the video. Why do you need to set the content-type for those files at all? What would the browser do if it receives those files without content-type specified?

michael.knight
Автор

Hi Steve,
I have a React app that is not seo friendly. To serve the content to seo, I am using Puppeteer to fetch the content and updating index.html. I can see index.html content updated. Expressjs static file serving used for serving the content to browser. Unfortunately, static content is not served to browser after Puppeteer update index.html.
Could you please suggest how we can serve updated content to browser like in React dev server live reload?

mtcindianutube
Автор

Your terminal leads with the word 'static'. Mine leads with the file directory of my server folder. Will you offer insight for this? Thank you.

yuske
Автор

Isn't nginx better suited for this shit?

strangelylookingperson