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

developer033
  • 24,267
  • 8
  • 82
  • 108

1 Answers1

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?

Community
  • 1
  • 1
po_taka
  • 1,816
  • 17
  • 27