marijnh / Eloquent-JavaScript

The sources for the Eloquent JavaScript book
https://eloquentjavascript.net
3.02k stars 796 forks source link

Ch.21: Corrupted content error when accessing http://localhost:8000 #504

Closed JulioDavidCh closed 6 months ago

JulioDavidCh commented 4 years ago

Evening, sorry for being insistent with this but i don't know if it's an issue on my part of if it's the code but when i run the skillsharing_server.js file with node and i go to the browser and do what the book says i should do here https://eloquentjavascript.net/21_skillsharing.html#p_rkcICOffJa i just get this error https://imgur.com/uGDeSIn on firefox v70.0.1 when i try on chrome, i get a similar error (non valid response ERR_INVALID_REDIRECT), these are the dependencies of the files https://pastebin.com/DSygaVAb, i think what happens is that ecstatic is not returning the index.html file properly as a response. Or maybe i didn't do what the book says here https://eloquentjavascript.net/21_skillsharing.html#p_mCtWt0pni3 and installed the JSX thing.

When i access http://localhost:8000/talks i get something, when i send the request with CURL i get an empty array [] or (or empty json?) and this is displayed on my screen https://imgur.com/qkf5eKH

marijnh commented 4 years ago

Hi. I'm not sure what is going wrong. When I follow the instructions you linked I get a working server. JSX is not used by this code. Does the node process crash when the problem occurs?

JulioDavidCh commented 4 years ago

No, the server "seems" to be working well https://imgur.com/a/rSdh615

JulioDavidCh commented 4 years ago

https://imgur.com/5K6JFWO when i do the requests with curl, the version of node im using is v12.13.0

JulioDavidCh commented 4 years ago

The server works, though, the convention mentioned here https://eloquentjavascript.net/21_skillsharing.html#p_jNP5xbaXQN doesn't seem to work, i have to manually go to http://localhost:8000/index or http://localhost:8000/index.html to go to the index instead of going to http://localhost:8000/ like it was mentioned here https://eloquentjavascript.net/21_skillsharing.html#p_rkcICOffJa

elossi7 commented 2 years ago

Did this issue get solved? I have the same problem in 2022. 127.0.0.1:8000/talks will give an empty array [ ] and 127.0.0.1/public/index.html will give a 404 message. Thanks for the book. It is great.

marijnh commented 6 months ago

127.0.0.1:8000/talks will give an empty array [ ] and 127.0.0.1/public/index.html will give a 404 message.

Those are both expected (if there are no talks). You want 127.0.0.1/index.html

Closing this until further information on the original issue comes in.