Skip to content

Commit

Permalink
Creacion de Ruta frontend
Browse files Browse the repository at this point in the history
 1.- cramos archivo routes.ml que apunta al controlador Test
 2.- creamos controlador Test
 3.- limpiamos cache  php bin/magento cache:clean
 4.- revisamos que el modulo este respondiendo con la siguiente URL
     magento2.local/helloworld/index/test
 5.- OJO : helloworld es el id que se registro en el archivo routes
  • Loading branch information
PerezContrerasLuis committed Jan 15, 2022
1 parent 38ff335 commit 106a361
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
18 changes: 18 additions & 0 deletions code/Luisdev/Helloworld/Controller/Index/Test.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php
namespace Luisdev\Helloworld\Controller\Index;
class Test extends \Magento\Framework\App\Action\Action
{
protected $_pageFactory;
public function __construct(
\Magento\Framework\App\Action\Context $context,
\Magento\Framework\View\Result\PageFactory $pageFactory)
{
$this->_pageFactory = $pageFactory;
return parent::__construct($context);
}
public function execute()
{
echo "Hello world!";
exit;
}
}
8 changes: 8 additions & 0 deletions code/Luisdev/Helloworld/etc/frontend/routes.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="standard">
<route frontName="helloworld" id="helloworld">
<module name="Luisdev_Helloworld"/>
</route>
</router>
</config>

0 comments on commit 106a361

Please sign in to comment.