title: How to serve static file using Restify
body: <p>I am working with a node application, where I need to serve static files(js,css).</p>
  
  <p>My project structure is like below:</p>
  
  <pre><code>-Projectroot
       -restifyServer
           -server.js
       -frontEnd
           -index.html
           -js
           -partials
           -css
  </code></pre>
  
  <p>server.js is not only the server it serves XML also.</p>
  
  <p>Also for serving index.html I have routing like below:</p>
  
  <pre><code>server.get('/', getIndexhtml);
  </code></pre>
  
  <p>And getIndexhtml callback is like:</p>
  
  <pre><code>var getIndexhtml = function indexHTML(req, res, next) {
      fs.readFile(__dirname + '/../frontendapp/index.html', function (err, data) {
          if (err) {
              next(err);
              return;
          }
          res.setHeader('Content-Type', 'text/html');
          res.writeHead(200);
          res.end(data);
          next();
  });
  }
  </code></pre>
  
  <p>When I start server and navigate my browser to '<code>http://localhost:8080/</code>' it loads html without static files.</p>
  
  <p>In console I get error like below:</p>
  
  <pre><code>http://localhost:8080/js/library/jquery.js 404 (Not Found)
  </code></pre>
  
  <p>How can I configure resitfy to serve static files. I have tried  <a href="https://gist.github.com/mcavage/1056404" rel="nofollow">this</a> solution but couldn't make it work.</p>
  
  <p>Thanks in advance.</p>