Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bab Server Statis #3

Open
listiani13 opened this issue Jul 30, 2017 · 0 comments
Open

Bab Server Statis #3

listiani13 opened this issue Jul 30, 2017 · 0 comments

Comments

@listiani13
Copy link

Hi kak equan, sebelumnya aku mau berterima kasih banyak udah buat buku Node JS terjemahan Indonesia. Membantu banget loh buat begineer kayak aku gini. Oh ya, aku baru sampe bagian 4, Server Statis, nah aku bingung di bagian
var url = parse(req.url),
path = join(root, url.pathname),
stream = fs.createReadStream(path);
aku bingung, req nya nanti dapet darimana ya? terus gimana caranya dia tau kalo mau masuk ke index.html? Sejauh ini saat saya coba code yg ada di ebook itu, yg jalan cuma handler error. Setelah saya ganti jadi dibawah ini, dia bisa jalan handler datanya.
var url = parse(req.url),
path = join(root, '/index.html'),
stream = fs.createReadStream(path);
Itu kenapa yaa kak? Terus reqnya sebenernya diambil darimana ya kak? karena server langsung dikasih server.listen(3000) aja dan ga masukkin parameter request/resultnya. Hehe thanks kak sebelumnya.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant