title: Angular js Routes, 500 internal server error
body: <p>I have a directory structure like this - </p>
  
  <pre><code>-project
    -public
       -app
          -app.js ( angular app module )
    -server
       -server.js ( node root js file )   
       -includes 
          -layout.jade
          -scripts.jade
       -views
          -index.jade
          -partials
             -main
                -main.jade
                -about.jade
                -about-vid.jade
                footer_main.jade
             -account
                -login.jade
  </code></pre>
  
  <p>Now when i try and use partials all in <strong>one 'partials'</strong> directory everything works fine, but when i try to organize them in seperate directories i get internal server error . here is the normal relevant code -
  app.js - </p>
  
  <pre><code>angular.module('app',['ngResource','ngRoute']);
  
  angular.module('app').config(function($routeProvider,$locationProvider){
      $locationProvider.html5Mode(true);
      $routeProvider
          .when('/', { templateUrl: '/partials/main', controller: 'mainCtrl'});
  });
  </code></pre>
  
  <p>server.js code - </p>
  
  <pre><code>app.use(express.static(__dirname + '/public'));
  app.get('/partials/:partialPath',function(req,res){
      res.render('partials/' + req.params.partialPath);
  });
  
  app.get('*',function(req,res){
      console.log(mongoMessage);
      res.render('index');
  });
  </code></pre>
  
  <p>index.jade rendered by server.js - </p>
  
  <pre><code>include ../includes/layout
  .header-white.navbar.navbar-default.navbar-static-top
      .container
          .navbar-header
              button(data-target=".navbar-collapse",data-toggle="collapse",class="navbar-toggle btn navbar-btn")
                  span.icon-bar
                  span.icon-bar
                  span.icon-bar
              a(href="/",class="navbar-brand")
                  img(alt="CampuStop",id="logoimg",src="/img/logo_big.png",style="height:74px")
          div(ng-include="'/partials/login'")
  block main-content
      div(ng-view)
  div(ng-include="'/partials/footer_main'")
  
  include ../includes/scripts
  </code></pre>
  
  <p>But if i try to organize them and make the following changes i get 500 internal server error in console for my login, 
  app.js - change template url to <strong>/partials/main/main/</strong></p>
  
  <pre><code>angular.module('app').config(function($routeProvider,$locationProvider){
          $locationProvider.html5Mode(true);
          $routeProvider
              .when('/', { templateUrl: '/partials/main/main', controller: 'mainCtrl'});
      });
  </code></pre>
  
  <p>index.jade - 
  change the include urls to respective directories : </p>
  
  <pre><code>div(ng-include="'/partials/account/login'")
  div(ng-include="'/partials/main/footer_main'")
  </code></pre>
  
  <p>server.js - <strong>replace :partialParams by *</strong></p>
  
  <pre><code>app.get('/partials/*',function(req,res){
          res.render('partials/' + req.params);
      });
  </code></pre>
  
  <p>Can any one tell me where i am going wrong or what other information should i provide?</p>