/**
  * Called in public/index.php to route our application.
  * Define your custom routes at the beginning of the function otherwise the stock routes will override them!
  */
 public static function route()
 {
     global $slim;
     /* Define your custom routes here */
     $slim->get('/example/', function () {
         echo "This is a custom route example!";
     });
     $slim->get('/example/:id/', function ($id) {
         echo "This is a custom route example! You picked ID " . $id;
     });
     /* Put your custom routes above this line! */
     # GET list
     $slim->get('/:type/', function ($type) {
         RapidRest::getList($type);
     });
     # GET item
     $slim->get('/:type/:id/', function ($type, $id) {
         RapidRest::getItem($type, $id);
     });
     # POST item
     $slim->post('/:type/', function ($type) {
         RapidRest::postItem($type);
     });
     # PUT item
     $slim->put('/:type/:id/', function ($type, $id) {
         RapidRest::putItem($type, $id);
     });
     # DELETE item
     $slim->delete('/:type/:id/', function ($type, $id) {
         RapidRest::deleteItem($type, $id);
     });
 }
<?php

# Load everything!
require '../config/loader.php';
$slim = new \Slim\Slim();
# Initialize the application. Custom logic goes below here.
# Set up RedBean
RapidRest::dbInit();
# It's just a configuration-friendly call to R::setup()
# Route our request
AppRouter::route();
# Add your custom routes to /lib/routes.php
$slim->run();
# Run the program