I am following this tutorial to set up my first page in a Symfony 3 project: Joyful Development with Symfony 3 Tutorial
I created a HomeController
file in /src/AppBundle/Controller/
. The contents of this file are:
<?php
namespace AppBundle\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\Response;
class HomeController {
/**
* @Route("/home")
*/
public function showAction() {
return new Response('Testing!');
}
}
I am simply trying to get the text: "Testing!" from the showAction()
function above to display. However, my page has an error: No route found for "GET /home"
Is there something wrong with my setup above? Sorry if this is a simple question, this is my first time working with Symfony and I am lost!
If you are testing on localhost, you can go to your project directory and use the built-in web server to test your project:
php bin/console server:start
and to stop it:
php bin/console server:stop
To debug routes, enter:
php bin/console debug:router
That should display all your routes. Once this works, it's a matter of getting your Nginx working.
You can also specify a different IP address for the built-in server. See the documentation: http://symfony.com/doc/current/setup/built_in_web_server.html#starting-the-web-server
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With