Local server Node.js does not find html file

Asked

Viewed 44 times

-1

I’m a beginner in the forum (in Node.js and html as well) so any errors warn.

I wanted to make a local server with Node.js (server.js), code below:

inserir a descrição da imagem aqui

This code should show the contents of the following code in html (index.html), code below:

inserir a descrição da imagem aqui

The problem is that on the web page returns the error 'File not found! ' (provided in the javascript code if it returned error):

inserir a descrição da imagem aqui

Both files are in the same folder:

inserir a descrição da imagem aqui

Apparently the server starts normally, the problem is really at the time of finding the html file. Would anyone know why you’re not finding the file?

1 answer

0

Tries

fs.readFile(__dirname+'/index.html'....

Browser other questions tagged

You are not signed in. Login or sign up in order to post.