Created
May 19, 2015 07:59
-
-
Save anvarazizov/769f11871a9312e8cea8 to your computer and use it in GitHub Desktop.
Fat-free framework JSON API route example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$f3->route('GET /api/user/@id', | |
function($f3) { | |
$id = $f3->get('PARAMS.id'); | |
header('Content-Type: application/json'); | |
$data = array('id'=>$id, 'name'=>'Taras', 'lastname'=>'Shevchenko'); | |
echo json_encode($data); | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
your code saved me from headhache. Thank you