title: How do I use Less with Express.js?
body: <p>I'm trying to use Less with Express.js however I'm not sure my setup is the correct one.</p>
  
  <p>My folder/files structure is the following :</p>
  
  <ul>
  <li>....</li>
  <li>app.js</li>
  <li>public
  
  <ul>
  <li>styles
  
  <ul>
  <li>test.less</li>
  </ul></li>
  </ul></li>
  <li>........</li>
  </ul>
  
  <p>And in my <code>app.js</code> :</p>
  
  <pre><code>var express = require('./node_modules/express');
  var lessMiddleware = require('./node_modules/less-middleware');
  var app = express();
  
  app.set('view engine', 'ejs'); 
  app.set("views", "./views");
  
  app.get('/', function(req, res, next) 
  {
      res.render('index.ejs');
  });
  
  app.use(lessMiddleware(__dirname + "/public/styles"));
  
  app.use(express.static(__dirname + '/public'));
  
  app.listen(3000);
  </code></pre>
  
  <p>In my <code>index.ejs</code> :</p>
  
  <pre><code>&lt;link rel="stylesheet" type="text/css" href="/public/styles/test.css"&gt;
  </code></pre>
  
  <p>If I understand correctly, the module is supposed to take my <code>test.less</code> and compile it into <code>test.css</code> before it serves it to the client ?</p>
  
  <p>What am I doing wrong ?</p>
  
  <p><strong>UPDATE :</strong> it looks like nothing is being served from /public..</p>
  
  <p><code>http://localhost:3000/public</code> returns <code>Cannot GET /public</code></p>