Ember.js with MySQL connection

I am trying to develop a small application ember. I want this to be a list of all the items from the MySQL database table. I can extract and display data from localStorage ember store, but I do not know how I can implement the same thing using a MySQL database.

Any help would be assigned.

+4
source share
2 answers

There are several ways to do this, but basically you need some kind of server-side API to handle actually querying the MySQL database and returning the data. This is usually done using the REST API using the JSON exchange format .

PHP, Node , Ember. , , , JSON , :

[
  {"title": "blog post 1", "body": "this is a blog post"},
  {"title": "blog post 2", "body": "this is another post"}
]

Ember - ajax:

var IndexRoute = Ember.Route.extend({
  model: function()
  {
    return $.getJSON("http://apiurl.com/search");
  }
});

Ember , , getJSON JQuery.

:

<script type="text/x-handlebars" data-template-name="index">
{{#each}}
  {{title}}<br/>
  {{description}}
{{/each}}
</script>

Ember EmberData ajax, , Ember , , EmberData. Discourse:

http://eviltrout.com/2013/03/23/ember-without-data.html

Ember Guides :

http://emberjs.com/guides/
http://emberjs.com/guides/routing/specifying-a-routes-model/

+4

Dreamfactory SaaS REST API, SQL NoSQL. SQL Server, RDS, . -, WIP Ember-Data . - TON , .

+2

Source: https://habr.com/ru/post/1530922/


All Articles