add new test routes
This commit is contained in:
+3
-1
@@ -90,7 +90,9 @@ if (strpos($request->path(), '/api/') === 0) {
|
|||||||
$router->get('/users/index', 'UsersController@index');
|
$router->get('/users/index', 'UsersController@index');
|
||||||
$router->post('/users/create', 'UsersController@create');
|
$router->post('/users/create', 'UsersController@create');
|
||||||
$router->get('/example/test', 'ExampleController@test');
|
$router->get('/example/test', 'ExampleController@test');
|
||||||
$router->get('/contratti/cerca', 'ContrattiController@cercaContratti');
|
$router->get('/contratti/cerca', 'ContrattiController@search');
|
||||||
|
$router->get('/dipendenti/cerca', 'DipendentiController@search');
|
||||||
|
$router->get('/api/dipendenti/cerca', 'DipendentiController@search');
|
||||||
|
|
||||||
// Rate limiting by IP address
|
// Rate limiting by IP address
|
||||||
$key = $_SERVER['REMOTE_ADDR'] ?? 'unknown';
|
$key = $_SERVER['REMOTE_ADDR'] ?? 'unknown';
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class ContrattiController {
|
|||||||
[ 'idContratto' => 'ID_CONTRATTO_005', 'titoloContratto' => 'Contratto Custom', 'idDomanda' => 'ID_0105', 'idRicevuta' => 'RIC_1005' ],
|
[ 'idContratto' => 'ID_CONTRATTO_005', 'titoloContratto' => 'Contratto Custom', 'idDomanda' => 'ID_0105', 'idRicevuta' => 'RIC_1005' ],
|
||||||
];
|
];
|
||||||
|
|
||||||
public function cercaContratti(Request $req, Response $res) {
|
public function search(Request $req, Response $res) {
|
||||||
$term = $req->query()['term'] ?? "";
|
$term = $req->query()['term'] ?? "";
|
||||||
|
|
||||||
$filtered = array_filter($this->contratti, function($contratto) use ($term) {
|
$filtered = array_filter($this->contratti, function($contratto) use ($term) {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class DipendentiController {
|
|||||||
[ 'codiceFiscale' => 'CDEFGH23I45J678K', 'nominativo' => 'MAMMI Pier-Paolo', 'email' => 'pierpaolo.mammi@unipr.it' ],
|
[ 'codiceFiscale' => 'CDEFGH23I45J678K', 'nominativo' => 'MAMMI Pier-Paolo', 'email' => 'pierpaolo.mammi@unipr.it' ],
|
||||||
];
|
];
|
||||||
|
|
||||||
public function cercaContratti(Request $req, Response $res) {
|
public function search(Request $req, Response $res) {
|
||||||
$term = $req->query()['term'] ?? "";
|
$term = $req->query()['term'] ?? "";
|
||||||
|
|
||||||
$filtered = array_filter($this->dipendenti, function($contratto) use ($term) {
|
$filtered = array_filter($this->dipendenti, function($contratto) use ($term) {
|
||||||
|
|||||||
Reference in New Issue
Block a user