I need a test function but it is not working. Supposedly with Routing + Controller should work, but I get a 404 not found.
This is my /app/config/routing.yml:
AndroidAPIBundle:
resource: "@MDPIAndroidApiBundle/Controller/"
type: annotation
prefix: /
Inside Controller directory I have LoginController.php:
/**
* @Route("/api/test", name="test")
*/
public function getAction(Request $request)
{
$format = "json";
$view = View::create()->setStatusCode(201)->setData(array("status"=>"OK", "data"=>array("test" => "DAN TEST")))->setFormat($format);
return $this->get('fos_rest.view_handler')->handle($view);
}
So why when I make a curl request I get a 404 message? Also in browser adding /api/test to my local url.
EDIT
php app/console router:debug
test ANY ANY ANY /api/test
EDIT 2
/etc/nginx/sites-available/susy_android_final
server {
listen 80;
server_name susy.android.final.local;
access_log /var/log/nginx/susy_android_final.access.log;
error_log /var/log/nginx/susy_android_final.error.log;
root /var/www/susy.mdpi.com.final/web;
client_max_body_size 500M;
large_client_header_buffers 8 64k;
location / {
index app_dev.php;
if (-f $request_filename) {
break;
}
rewrite ^(.*)$ /app_dev.php last;
}
## Parse all .php file in the /var/www directory
location ~ (app|app_dev|app_eudev).php {
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_pass unix:/var/run/php/php5.6-fpm.sock;
#fastcgi_pass 127.0.0.1:9001;
#fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;
include fastcgi_params;
}
}
/etc/hosts
127.0.0.1 susy.android.final.local
This is in ubuntu