samedi 19 septembre 2015

Error while routing the the page error code:Error: ENOENT, stat '/public/index.html' using node

I use This code :

var express = require("express");
var path =  require("path");
var app =  express();
app.use(express.static(path.join(__dirname, 'public')));
app.use("/",function(req,res){
    res.sendfile('/public/index.html');
  //res.send("test");
}),
app.listen(5401)

It working fine when I Enter url On Browser. shown in pic.

enter image description here

but in terminal i always getting en error :ENOENT, stat '/public/index.html' I don't know what is my mistake and i am using emberjs on client side




Aucun commentaire:

Enregistrer un commentaire