router.config.php 865 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. /*
  3. *---------------------------------------------------------------
  4. * Router map configuration
  5. *---------------------------------------------------------------
  6. *
  7. * You can use this configuration to set you default application
  8. * routes.
  9. */
  10. return array(
  11. /**
  12. * JSON response benchmark
  13. */
  14. 'json' => function()
  15. {
  16. return CCResponse::create( json_encode(
  17. array('message' => 'Hello, World!')
  18. ), 200 )->header( 'Content-Type', 'application/json' );
  19. },
  20. /**
  21. * JSON response benchmark
  22. */
  23. 'db' => function()
  24. {
  25. $queries = CCIn::get( 'queries', 1 );
  26. $worlds = array();
  27. for($i = 0; $i < $queries; ++$i)
  28. {
  29. $worlds[] = DB::select( 'World' )->find( mt_rand(1, 10000) );
  30. }
  31. return CCResponse::create( json_encode( $worlds ) )
  32. ->header( 'Content-Type', 'application/json' );
  33. },
  34. 'fortunes' => 'Bench@fortunes',
  35. );