Node.js Tutorial for Beginners - 14 - Simple Web File Server

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

These tutorials are seriously the best that have ever been made
Bucky u'r a legend

nischaymalhanshorts
Автор

bucky is the best! this guy is single handedly gona turn me into a junior dev

ITPCD
Автор

PSA : If you guys have trouble getting the server to run because it can't locate your index.html, try changing your path from "./index.html" to "./public/index.html"
I'm not sure why bucky's code works, when his index.html is located inside the public folder, but this solved the issue for me

pockethummus
Автор

i always understand your lessons bucky. you are gifted.

samsideenhydara
Автор

Awesome teaching! Not everybody can teach as clearly as you do!

kaichengwang
Автор

Thanks, first guy that explained node.js to me this well !

wimdenherder
Автор

How would you go about including the css file for the web page with this? It's sending the html fine but not the stylesheet.

thewatt
Автор

What if someone tries to access a page other than the home page, that we did create? The if condition will still fail even though they should be directed to a page, right?

AxiomTutor
Автор

I duplicated this structure with my server.js and index.html in a subfolder called public and receive error 141 that it could not find file index.html in the root folder.Works fine if I use either of the following but wondering why "./index.html" fails where it works for Bucky. Any thoughts?

davespangler
Автор

i would love to buy you some bacon and tuna bro

msabur
Автор

Nevermind! Fixed it :D had to change a thing or two, but it's working now. Say, Bucky, can you do more of these tutorials?

ModdyGamer
Автор

I'm having some issues with this. I'm using Atom. When I run this code, I sometimes get it working and more often don't, or it takes a long while for the response to go through. It's also catching the if statement and returning 404 often when it shouldn't.
Edit: actually, it keeps making the request until it works, lol. The 404 message has yet to show up. It was doing this when I was trying out the code from the last video too. It keeps trying until it works on a whim.

youngidealist
Автор

But now the favicon won't load right? Since everything besides / will get 404d.

kevinjohansson
Автор

First of all: BIG THANK YOU!
You explain it all perfectly and so gradually that it becomes very easy to understand.

That being said, I have a question :)
Is it not necessary to write "response.end();" after the command? Does fs close the response automatically?

Hope you see this

janesparza
Автор

When i call my localhost:8888, show me entire html not only the body. Is literally the skeleton of archive index.html. Why this happen?

ricardohernandez
Автор

sir, you already push your name to my loving persons list. You just awesome .
I had got a problem when i use " createReadStream " . its not display any text to my browser. Then i try to this

fs.readFile('./index.html', function(err, html){
response.write(html);
response.end();
});
and works well . I am totally new in node.js .

sazalrahman
Автор

Please someone help me! Im trying to get my folders to appar on the left side on the screen for easy access, and I've spent over a half hour trying every button around that area. Please help me

lenkymofo
Автор

does the .pipe method have internal code that includes response.end() ?

i noticed you included it in the error404 method that you created but did not place it in the initial if block that sends the index.html

matthewjimenez
Автор

This is great that you're using Idea

kolos
Автор

Getting error on line 14 and web page showing nothing using Intellij idea
if( request.method == 'GET' && request.url == '/' ) Comparison may cause unexpected type coercion

inzamamulhaq