1

Im new using slim framework and Im trying to make a get. It doesn't return anything and it returns a code 200.

$app->get('/noticias',function ()use ($db,$app){
    try{
        $consulta = $db->prepare("select * from noticias");
        $consulta->execute();

        $resultados = $consulta->fetchAll(PDO::FETCH_ASSOC);
        echo json_encode($resultados);
    }catch (Exception $ex){
        echo  'We cant show the news';
    }
});

When I make a get this is the result

Do you know some tutorials of slim framework??

Thanks

jmattheis
  • 10,494
  • 11
  • 46
  • 58
ATellez
  • 115
  • 1
  • 11

1 Answers1

0

I'm unclear if you're using Slim version 2 or 3. You should be using version 3.

The documentation has the First Application Walkthrough tutorial that you should go through.

Rob Allen
  • 12,643
  • 1
  • 40
  • 49