7

I would like to build an application using Laravel as backend and Yeoman to build and manage my frontend. I know quite a few of these technologies.

I did not found a lot of worflows that would explain how to communicate between separate Laravel app and yeoman app (on different servers e.g). Maybe CORS is a good option.

Is anyone ever try to separate backend and frontend (with these technologies)?

sideshowbarker
  • 81,827
  • 26
  • 193
  • 197
lightalex
  • 879
  • 1
  • 11
  • 26

3 Answers3

11

Yeoman is not a front end framework - rather an application scaffold for generating a starting point for your front end.

Angular JS is my preferred option when using Laravel as a backend. You can use Yeoman to set up an Angular front end using this:

https://github.com/yeoman/generator-angular

An excellent tutorial series that helped me a lot when setting AngularJS up to talk to Laravel is here:

https://github.com/davemo/end-to-end-with-angularjs

Included is quite an extensive explanation on AngularJS security.

The Laravel backend should be setup as an API in the first instance to accept requests, heres a starting point to setup a basic API in Laravel from Laracon 2013

https://github.com/akuzemchak/laracon-todo-api

Laracasts also has a great series for building API's:

https://laracasts.com/series/incremental-api-development

Laracasts is a paid subscription service but would fully recommend it to Laravel beginners/intermediates

markinnes
  • 125
  • 1
  • 10
0

I know it's a long time ago since the question was asked, but perhaps it helps someone on it's way..

I would start with this package: https://github.com/jadjoubran/laravel5-angular-material-starter

Overview: http://www.laravel-angular.io/#/

which gives you:

  • Laravel 5.1
  • Angular
  • Angular Material

and much other stuff, preconfigurated, out of the box..

ndberg
  • 3,391
  • 1
  • 21
  • 36
-5

In short:

CORS is a bad option.

Issue all the requests to the frontend server and make it forward backend-specific requests to the backend server.
In production have all the stuff served exclusively by backend server.

Here's how to achieve that for Java-based frameworks and also for Django: https://stackoverflow.com/a/20680962/1432478
Should look similar for your framework & build system.

Community
  • 1
  • 1
vucalur
  • 6,007
  • 3
  • 29
  • 46
  • This doesn't really help me neither regarding the technologies I will use, nor how to communicate between my Yeoman frontend and Laravel backend. I guess I could use $http in Angular referring to this website : [Here](http://www.itaware.eu/2012/09/05/angularjs-ajax-et-rest/) – lightalex Mar 06 '14 at 14:42