I've tried this tutorial on how to set up a localhost, and some code worked, some didn't. But currently I am receiving strange experience with it:
Below in the code at res.sendfile
it's important to mention that the terminal comments this command as deprecated.
Using res.sendFile
gives however the following error.
I've tried to use .sendFile
with the absolute path, but it didn't work:
res.sendFile('localhost:3000/client/index.html');
var app = require('express')();
var http = require('http').Server(app);
var io = require('socket.io')(http);
var port = 3000;
app.get('/', function(req, res){
res.sendfile('client/index.html');
});
I am just trying to make a simple connection between the server.js and the index.html. The expected output is to have index.html
displayed instead of the error.