안녕하세요. Git repository 다음 경로가 있지만이 경로의 결과를 가져올 수 없습니다. Postman을 사용하여 Symfony FOSRestBundle 경로를 테스트하는 방법. FOSRestBundle을 구성하는 방법
php console debug:route
_wdt ANY ANY ANY /_wdt/{token}
_profiler_home ANY ANY ANY /_profiler/
_profiler_search ANY ANY ANY /_profiler/search
_profiler_search_bar ANY ANY ANY /_profiler/search_bar
_profiler_info ANY ANY ANY /_profiler/info/{about}
_profiler_phpinfo ANY ANY ANY /_profiler/phpinfo
_profiler_search_results ANY ANY ANY /_profiler/{token}/search/results
_profiler ANY ANY ANY /_profiler/{token}
_profiler_router ANY ANY ANY /_profiler/{token}/router
_profiler_exception ANY ANY ANY /_profiler/{token}/exception
_profiler_exception_css ANY ANY ANY /_profiler/{token}/exception.css
_twig_error_test ANY ANY ANY /_error/{code}.{_format}
get_users_all GET ANY ANY /v1/users/all.{_format}
get_user GET ANY ANY /v1/users/{id}.{_format}
나는 설정과 경로를 구성 할 필요가 있지만, 나는이 함께 붙어. FOS 컨트롤러 파일입니다.
/**
* Class UsersController
* @package AppBundle\Controller
*/
class UsersController extends FOSRestController
{
/**
* @return \Symfony\Component\HttpFoundation\Response
* @View(serializerGroups={"user"})
*/
public function getUsersAllAction()
{
$users = $this->getDoctrine()->getRepository('AppBundle:User')->findAll();
$view = $this->view($users, 200);
return $this->handleView($view);
}
/**
* @param $id
* @return \Symfony\Component\HttpFoundation\Response
* @View(serializerGroups={"user"})
*/
public function getUserAction($id)
{
$user = $this->getDoctrine()->getRepository('AppBundle:User')->find($id);
if (!$user instanceof User) {
throw new NotFoundHttpException('User not found');
}
$view = $this->view($user, 200);
return $this->handleView($view);
}
}
해결 방법은 무엇입니까? 이미 symfony의 모든 문서를 보았으며 구성 방법을 이해할 수 없습니다. 의 bitbucket에
코드 (공공) : 당신이 당신 dev에 환경에서 사용할 수있는 경로를 보여 심포니에 요구하고
php app/console --env=dev debug:router
또는
php app/console debug:router
이 명령을 git pull https://[email protected]/fonjeekay/resttest.git
감사를 보일 것
<VirtualHost *:80> ServerAdmin [email protected] DocumentRoot "/var/symfony/web" ServerName localhost ServerAlias localhost DirectoryIndex app.php </VirtualHost>
통지 ... 난 것 이것을 확인하십시오 – fonjeekay
나는 이미 이것을 시도했습니다 ... 결과가 없습니다 ... 다시 404 – fonjeekay
괜찮 았지만 프로젝트의 페이지를 표시 할 수 있습니까? 'Hello World'를 표시하는 간단한 페이지 인 FOSRestController를 확장하지 않는 다른 컨트롤러에 경로를 추가하십시오. symfony의 기본 예제를 확인하십시오. 웹 서버를 올바르게 구성하지 않았을 수 있습니다. – stuzzo