user2632918
user2632918

Reputation:

AngularJS 2 as Frontend and Symfony 3 as backend

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

Upvotes: 0

Views: 1248

Answers (1)

po_taka
po_taka

Reputation: 1856

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?

Upvotes: 2

Related Questions