title: How to serve static content in Nancy
body: <p>I'm having trouble serving up static content such as JavaScript in Nancy.</p>
  
  <p>For example using the <a href="https://github.com/NancyFx/Nancy/tree/master/src/Nancy.Demo.Hosting.Self">self hosting sample</a> I have added a test.js to the Views folder and added a </p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;script type="text/javascript" src="test.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>tag to the staticview.html page. If I view this page in the browser the JavaScript is executed correctly.</p>
  
  <p>However when I run the sample the JavaScript is not executed. If I view the page in FireBug I see that I'm getting a 404 error for test.js.</p>
  
  <p>I've tried adding </p>
  
  <pre class="lang-cs prettyprint-override"><code>Get["{file}"] = p =&gt;
  {
      string path = string.Format("Views/{0}", p.file);
      return Response.AsJs(path);
  };
  </code></pre>
  
  <p>and when I set a break point and execute Response.AsJs(path) in the immediate window I get a StatusCode of NotFound</p>
  
  <p>I've also tried adding a StaticContentConvention such as </p>
  
  <pre class="lang-cs prettyprint-override"><code>protected override void ConfigureConventions(NancyConventions conventions)
  {
      base.ConfigureConventions(conventions);
      conventions.StaticContentsConventions.Add(
          StaticContentConventionBuilder.AddDirectory("/", "Views"));
      conventions.StaticContentsConventions.Add(
          StaticContentConventionBuilder.AddDirectory("Views", "Views"));
  }
  </code></pre>
  
  <p>What am I doing wrong?</p>