0

I will start a new project with angularjs and symfony 2.

I just wanna know if my way, how I will realise it, is good.

The AngularJS frontend would be available over https://www.example.com and the backend of symfony would be under https://api.example.com.

So I hope that the routing of every framework would not colidate. And I have also a available API for the mobile Devices.

Is this a best practice or is it better to use the api under https://www.example.com/api

1 Answer 1

2

IMO it is better to create 2 separate projects.

  • for the api (api.example.com)
  • for the front-end (example.com)

This way you avoid problems with:

  • routing (like you point - collisions)
  • sessions (api do not need sessions at all)
  • packages - e.g. your api could use symfony 3.1, but your front-end symfony 2.7
  • easier load balancing (IMO)

see: Is it better to place a REST API on a subdomain or in a subfolder?

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for your quick answer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.