title: MySQL API with Slim Framework
body: <p>Okay, so I've finally managed to get my API working in the slim framework on my MAMP localhost with this code in my index.php:</p>
  
  <pre><code> $app = new \Slim\Slim();
   $app-&gt;get('/people', function() use ($app, $mysqli) {
       $testQuery = "SELECT name FROM People";
       $results = $mysqli-&gt;query($testQuery);
  
       $app-&gt;response()-&gt;header('Content-Type', 'application/json');
       while ($row = $results-&gt;fetch_assoc()) {
           echo json_encode($row);
       }
   });
   $app-&gt;run();
  </code></pre>
  
  <p>Now, when I go to localhost/index.php/musicians, I get exactly what I expect -- JSON encoded text representing the names on the people table. However, if I just go to localhost, I get text I printed earlier in the index.php file AND a 404 error. Moreover, when I run index.php in the console, I get this error message:</p>
  
  <blockquote>
    <p>Notice: Undefined index: REQUEST_METHOD in /Applications/MAMP/htdocs/vendor/slim/slim/Slim/Environment.php on line 123</p>
    
    <p>Notice: Undefined index: REMOTE_ADDR in /Applications/MAMP/htdocs/vendor/slim/slim/Slim/Environment.php on line 126</p>
    
    <p>Notice: Undefined index: REQUEST_URI in /Applications/MAMP/htdocs/vendor/slim/slim/Slim/Environment.php on line 143</p>
    
    <p>Notice: Undefined index: REQUEST_URI in /Applications/MAMP/htdocs/vendor/slim/slim/Slim/Environment.php on line 148</p>
    
    <p>Notice: Undefined index: SERVER_NAME in /Applications/MAMP/htdocs/vendor/slim/slim/Slim/Environment.php on line 159</p>
    
    <p>Notice: Undefined index: SERVER_PORT in /Applications/MAMP/htdocs/vendor/slim/slim/Slim/Environment.php on line 162</p>
  </blockquote>
  
  <p>The API is clearly succeeding in creating a RESTful API, but I'm worried about what's going on with index.php and these error messages. </p>