Moros1138 / RESTful-Route

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RESTful-Route

$r->add_route('GET', 'users', function($args) {
	
	extract($args);
	
	return array(
		'code' => 200,
		'data' => array('message' => 'It worked in GET')
	);
});

// SECOND EXAMPLE
$r->add_route('GET', 'users/{id}', function($args) {
	
	extract($args);
	
	return array(
		'code' => 200,
		'data' => array('message' => "It worked in GET for ID ({$id})")
	);
	
});

// does route comparisons and responses
$r->run();

About

License:MIT License


Languages

Language:PHP 100.0%