I get an error when I try to open my page.

Code:

var express = require('express'), app = express(), server = require('http').createServer(app), io = require('socket.io').listen(server); server.listen(3000); app.get('/', function(req, res){ res.sendfile(___dirname, '/index.html'); }); 

Closed due to the fact that off-topic by participants Kromster , Alex , Duck Learns to Hide , user194374, Denis Bubnov 30 Dec '16 at 7:11 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • "The question is closed, as it is customary to ask questions in Russian only on Russian in Stack Overflow . Please translate your question into Russian or use Stack Overflow in English ." - Kromster, Alex, Duck Learns to Hid, Community Spirit
If the question can be reformulated according to the rules set out in the certificate , edit it .

  • Describe the error that occurs - Mikhail Vaysman
  • When opening the site, the error "Cannot GET /" occurs, the source code is attached above. - Andrew Rogachuk
  • @AndrewRogachuk due to the subject matter of the site, although most of the participants know English, the question should be asked in Russian. Please translate the title of your question and the text in question. To do this, use the edit link located under the question marks. - Alex

1 answer 1

Instead of this

 res.sendfile(___dirname, '/index.html'); 

write it

 res.sendfile(__dirname + '/index.html'); 
  • or more simply res.sendfile ("./ index.html"); - pnp2000