I'm building a Magento 2 module, I need to set up a frontpage page and show some information, I have created my routing:
routes.xml (in namespace/modulename/etc/frontend
)
<?xml version="1.0"?>
<!--
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="standard">
<route id="namespace_modulename" frontName="modulename">
<module name="Namespace_ModuleName"/>
</route>
</router>
</config>
I have also my Controller:
<?php
namespace Namespace\ModuleName\Controller\Index;
use \Magento\Framework\App\Action\Context;
class Index extends \Magento\Framework\App\Action\Action
{
/**
* Index constructor.
*
* @param Context $context
*/
public function __construct(
Context $context
) {
parent::__construct($context);
}
/**
*
* @return \Magento\Framework\View\Result\PageFactory
*/
public function execute()
{
echo "Test";
exit;
}
}
When i go to modulename/index/index
I'm getting g page not found.
Not sure why, any ideas? Already done magento upgrade and i can see the module there.
My module registration:
<?php
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE,
'Namespace_ModuleName',
__DIR__
);