res.sendfile() doesn't serve javascripts well
I guess this might help you...
in app.js
file...
app.use(app.router);app.use(express.static(path.join(__dirname, 'public')));app.use("/styles", express.static(__dirname + '/public/stylesheets'));app.use("/scripts", express.static(__dirname + '/public/javascripts'));app.use("/images", express.static(__dirname + '/public/images'));// development onlyif ('development' == app.get('env')) { app.use(express.errorHandler());}app.get('/', function (req, res) { res.sendfile(__dirname + '/public/home.html');});
save the home.html
inside the /public
folder and JavaScript files in /public/javascripts
, images in /public/images
, css files in /public/stylesheets
folder.
In the HTML file reference should be the words you define(eg: /scripts
/home.js)... like this
<link rel="stylesheet" type="text/css" href="/styles/home.css" > <script src="/scripts/home.js" type="text/javascript"></script>