Laravel + Angular JS & Yeoman

I’m currently working on a project that involves using Laravel and Angular JS. My initial approach was to have the Angular JS codebase live under the the Laravel codebase. However, from my research so far this seems to create several problems. Therefore, I’m now separating the application into two distinct codebases that know nothing about each other or at least that is the plan. The Laravel codebase will act as rest client that angular js interacts with through http and its own service layer. Does this seem like a good approach or should I try to merge them both together? I can’t really see a downside to this approach myself so long as the Laravel application remains only a rest client and the angular js one the client facing application.

I also have a follup question that fits this topic. The Laravel application lives on the default homestead vm. However, the angular js application will live on a separate vm configured via puphpet. What is the proper way to allow the angular js app to make service requests to the laravel app without running into the same origin policy restrictions?

  • Both boxes use nginx instead of apache

I believe you’ll need to configure nginx to output the correct headers. There’s an example here.

Cool, I havn’t got that far in yet but when I need to hook them both up that will come in handy.

Is there any reason why it would be better to declare the headers at the server level rather than the application level. The reason I ask is I found this package and it seems to be working well.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.