I'm using apigility (ZF2). The following error occurs when sending a request: The requested URL could not be matched by routing. The error occurs when I try to get a get request through the link: http://0.0.0.0:8888/leads
using the postman (chrome plugin).
The error is supposed to refer to some route error. However, you can not see this error yet.
The directory structure follows below:
The code for my chat / module.php file is as follows:
<?php
namespace chat;
use chat\V1\Rest\Leads\LeadsEntity;
use chat\V1\Rest\Leads\LeadsMapper;
use Zend\Db\ResultSet\ResultSet;
use Zend\Db\TableGateway\TableGateway;
use ZF\Apigility\Provider\ApigilityProviderInterface;
class Module implements ApigilityProviderInterface
{
public function getConfig()
{
return array(
'factories' => array(
'chatLeadsTableGateway' => function($sm) {
$dbAdapter = $sm->get('Adaptador');
$resultSetPrototype = new ResultSet();
$resultSetPrototype->setArrayObjectPrototype(new LeadsEntity());
return new TableGateway('nomedatable', $dbAdapter, null, $resultSetPrototype);
},
'chat\V1\Rest\Leads\LeadsMapper' => function($sm) {
$tableGateway = $sm->get('chatLeadsTableGateway');
return new LeadsMapper($tableGateway);
}
),
);
}
public function getAutoloaderConfig()
{
return array(
'ZF\Apigility\Autoloader' => array(
'namespaces' => array(
__NAMESPACE__ => __DIR__,
),
),
);
}
}
The code for the chat / module.config.php file is as follows:
<?php
return array(
'router' => array(
'routes' => array(
'chat.rest.leads' => array(
'type' => 'Segment',
'options' => array(
'route' => '/leads[/:leads_id]',
'defaults' => array(
'controller' => 'chat\V1\Rest\Leads\Controller',
),
),
),
),
),
Below the project folder structure