title: Using Fat-Free PHP for Backbone.js routing with external Model.php files
body: <p>I'm very new to Fat-Free and Backbone.js. I've been searching and reading articles and searching and reading articles trying to find a way to route to individual PHP files containing the database communications. The code below works, and I can use it, but it seems hackish. Is there a way to call an external PHP file (in the server/models/ directory) and a specific method from the $f3-route(...) line?</p>
  
  <pre><code>&lt;?php
  
  // File: /index.php
  
  define("PATH",1);
  
  $f3 = require('server/fatfree/lib/base.php');
  
  $uri = explode('/', $_SERVER["REQUEST_URI"]);
  require_once "server/models/{$uri[PATH]}.php";
  
  $f3-&gt;route('GET /hello/@file', 'HelloModel-&gt;doSomething');
  $f3-&gt;route('GET /project/@file', 'ProjectModel-&gt;doSomething');
  $f3-&gt;route('GET /book/@file', 'BookModel-&gt;doSomething');
  
  $f3-&gt;run();
  
  ?&gt;
  </code></pre>
  
  <p>Thanks a lot for your advice.</p>