If i do
res.sendfile('public/index1.html');
then I get a warning about the server console
express deprecated res.sendfile : use res.sendfile instead
but it works great on the client side.
But when I change it to
res.sendFile('public/index1.html');
I get an error
TypeError: the path must be absolute or point root to res.sendfile
and index1.html not displayed.
I can not understand what the absolute path is. I have a public directory at the same level as server.js . I am making res.sendfile from server.js . I also declared app.use(express.static(path.join(__dirname, 'public')));
Adding a directory structure:
/Users/sj/test/ ....app/ ........models/ ....public/ ........index1.html
What is the absolute path to point here?
I am using Express 4.x.
Kaya Toast Aug 23 '14 at 15:20 2014-08-23 15:20
source share