I am trying to build a simple REST API for a dictionary App. I would like to have two GET
methods that will get you the word by id and query(string). The problem is that the Slim framework routes everything through the first method and ignores the second one. I understand why it does it and I know you can use query string params but I am hoping there would be a way I can accomplish it this way. Thank you for your help.
http://localhost:5000/dictionary_api/words/1
$app->get('/words/:id', function($id) use ($app, $db) {
});
http://localhost:5000/dictionary_api/words/hello
$app->get('/words/:word', function($word) use ($app,$db){
});