Ember-CLI rundown using it with Laravel or other backend frameworks

ember-cli, ember.js, javascript, laravel, laravel-4

Solution

Here is one way to do it

Go into your root `laravel` folder and run the `ember new my_app_name`

Then go into your `my_app_name` folder and create a new file `build_custom.sh` add the following lines to the file

ember build
cp dist/index.html ../app/views/ember.php
cp -r dist/assets ../public/assets

Explanation: the first line builds your ember-cli app and generates all the necessary files in the `dist/` folder. The second line copies the `index.html` file generated to `app/views/` folder and renames it `ember.php` so laravel can recognize it. The last line just copies all the assets into your laravel public folder

You can add the following in your `app/routes.php` file in laravel to serve your ember app. Make sure it's all the way at the bottom so your other api routes take preference

Route::get('{ember?}', function() {
    return View::make('ember');
})->where('ember', '.*'); 

That should be it, everything should work as intended. Good luck.

Problem

Using the `ember-starter-kit` all I had to do was throw the contents of it in the `/my_laravel_app/public` folder and everything was fine. Now I am trying to create a project with `laravel` and `ember-cli` I'm a little confused as to how I need to structure my application? In which laravel folder should I be running the `ember new my-app` command? Furthermore, how can I use `apache` for testing my `ember-cli` application instead of using `ember server` command since I need to test it with my laravel generated apis. Any help is much appreciated!

Original source