2

I'm looking for some advice on how to connect to a MySQL database in my Ember application. I've created a dashboard with some charts using ZingChart's ember-zingchart addon, and my chart configuration JSON packets are kept in the associated controller for each template. I would need to query the db for different sets of data stored in the same table for each tab of my dashboard. Should I use PHP to connect to the database? If so, where would I place the PHP code for each template and how would I get the retrieved data into my controller? I'm still new at Ember, so if someone could nudge me in the right direction, that would be very helpful!

1
  • 1
    If you're using Ember, why not use Ember CLI? Commented Mar 2, 2015 at 22:59

1 Answer 1

4

Ember is front end only. If you are looking to connect your front end app to a server side database, you must write some sort of RESTful API that preferably uses JSON as the data transport format from client (front end) to server (back end).

You can write your API in any language you wish. Any code you write will not be a part of your Ember app codebase.

Once you have your API written you will access it with AJAX calls, either via Ember Data or using jQuery's $.ajax directly in your Route's model hook.

I know this is a high level response, but I get the feeling your missing some fundamental concepts about the client/sever relationship.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.