"Missing Template" when trying to use JSONView in CakePHP 3

1

I'm trying to create a JSONView response for my application. I followed the steps described in link , but I still get the error < strong> Missing Template , follow the code below:

In the routes.php file:

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

In the AppController.php file :

$this->loadComponent('RequestHandler');

In the 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 the Missing Template error. What can I be doing wrong?

    
asked by anonymous 13.09.2017 / 16:51

0 answers