"Missing Template" when trying to use Jsonview in Cakephp 3

Asked

Viewed 64 times

1

I am trying to create a Jsonview response to my application. I followed the steps described in the manual https://book.cakephp.org/3.0/en/views/json-and-xml-views.html, but I keep getting the bug Missing Template, follows the code below:

In the archive Routes.php:

$routes->setExtensions(['json']);

In the archive Appcontroller.php:

$this->loadComponent('RequestHandler');

In the archive Userscontroller.php:

public function fetch() {    
        $users = $this->Users->find();

        $this->set(compact('users'));
        $this->set('_serialize', ['users']);
    }

When trying to access the url /users/fetch.json i always get Missing Template error. What I might be doing wrong?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.