How much of my app should be EmberJS?


#1

Hi all,

I’m very new to the idea of EmberJS and I’m trying to figure out just how much of my app should be running on Ember. My app is built entirely in Laravel and currently I’m building it just how you’d expect, using it’s templating library to run for loops through the data I send to the view.

Do I only do data fetch type things with Ember, or everything? Should my signup process be Ember, signin? It’s all very confusing, or I’m just a bit of a lost goof.

Any help leading me in the right direction would be greatly appreciated.

Thanks!


#2

Hi,

I`m using emberjs for almost everything. Laravel only for requesting json data.


#3

So when someone fills in your signup form and hits the submit button, you’re using Ember to hit a Laravel API endpoint to create a user and respond back with the result? Is your app a one page webapp or do you still use Laravel routes for URL structure, etc, and Ember for the actual receiving and sending of data on that route?


#4
  1. Yes.
  2. Yes, only one page.

#5

Hi! I haven’t used Laravel specifically, but it looks very similar to several MVC frameworks I have worked with. Ember will be happiest if you give it complete control of the front end, and only use Laravel as a json rest framework. The easiest way to do this is probably to have Laravel serve a root ‘/’ view that is your client app. There are many ways of doing this, and I don’t know the specifics of Laravel, but I’ve never come across a rest framework that couldn’t do something like serve a ‘public’ or ‘assets’ folder filled with your client scripts. Then have Laravel routes for creating and updating the data you want to work with. This is commonly called ‘crud’ for Create Read Update Delete. So you might define a route like: POST /entity which ember can send a json description of the entity to so that Laravel can create that entity in your database. Then a GET /entity/id would get back a description of that entity.

What I’m describing here is just a client rich REST application, so if you’re familiar with architecting those already then I apologize. I’ve been answering this question at work a lot recently, so I have a ready made schtick that just comes out automatically now :slight_smile: