Node.js en Windows: express.js app.get enrutamiento con archivos no funciona

nodejs 0.8 on Windows with express:

Custom routing:

app.get("/less/file.less",  function(req, res){
  res.send("XXX");
});

If a file is available via URL (for example /less/file.less - public) it propose to download file, instead of returning "XXX" response. I have other behaviour on linux machine.

What can be is wrong? Is it possible to fix?

A

preguntado el 02 de julio de 12 a las 12:07

Probablemente estés usando app.use(express.static(__dirname + '/less')); in your app settings (or something like this) antes app.use(app.router);. Make the latter one set earlier. -

Your question is not clear for me. But I guess problem is that filesystem is different. What /less/file.less under windows should be something like c:\less\file.less. -

Thanks to freakish! The problem was in app.use(app.router). If you want you may answer I will mark it. Thanks again! -

0 Respuestas

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.