开发者

Node.js not parsing external javascripts correctly

开发者 https://www.devze.com 2023-02-25 20:09 出处:网络
So the problem is that node.js doesn\'t send my javascript files correctly. I can find them in the html code, but they are not executed by the browser. Th开发者_StackOverflowose js files don\'t even a

So the problem is that node.js doesn't send my javascript files correctly. I can find them in the html code, but they are not executed by the browser. Th开发者_StackOverflowose js files don't even appear in the firebug's NET panel when I reload the page.

I am using Express with Jade.

Any ideas how to fix this issue? Or what's causing it?


Make sure you have express.static set properly in app.configure.

app.configure(function(){
  app.set('views', __dirname + '/views');
  app.set('view engine', 'jade');
  app.use(express.bodyParser());
  app.use(express.methodOverride());
  app.use(app.router);
  app.use(express.static(__dirname + '/public'));
});

// Also, make sure you have the most updated versions of express and node.js. Both change often.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号