# Difficulties understanding store interactions between client and server

**URL:** https://meta.discourse.org/t/difficulties-understanding-store-interactions-between-client-and-server/286859
**Category:** Development
**Tags:** rest-api
**Created:** [November 28, 2023, 4:29pm UTC](https://meta.discourse.org/t/difficulties-understanding-store-interactions-between-client-and-server/286859 "2023-11-28T16:29:28Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Dimitrie\_David](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dimitrie_david/32/344465_2.png) [@Dimitrie\_David](https://meta.discourse.org/u/Dimitrie_David)
#### Post date: [November 28, 2023, 4:29pm UTC](https://meta.discourse.org/t/difficulties-understanding-store-interactions-between-client-and-server/286859/1 "2023-11-28T16:29:28Z")

</div>

Hello,

So I am trying to develop a custom plugin for my community. I have followed the tutorials for developing a plugin by @eviltrout and the tutorials still miss important information about communicating between the frontend and backend. I read that everything is ajax calls, but I have found a plugin example that I cannot understand.

I am looking at this [Notebook plugin](https://github.com/kleinfreund/notebook/).  
So I understand the [server routes](https://github.com/kleinfreund/notebook/blob/main/app/controllers/notes_controller.rb) and the client controller. What I cannot understand is how are the server routes called, even if there are no ajax calls.

I think it has something to do with the `RestModel` that the `note` model extends.  
Still I cannot find the implementantion that specifies what routes you have to define in the server so that the store in ember can use.

I would greatly appreciate any help!

---

<div class="post-metadata">

### Author: ![Dimitrie\_David](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dimitrie_david/32/344465_2.png) [@Dimitrie\_David](https://meta.discourse.org/u/Dimitrie_David)
#### Post date: [November 28, 2023, 4:37pm UTC](https://meta.discourse.org/t/difficulties-understanding-store-interactions-between-client-and-server/286859/2 "2023-11-28T16:37:31Z")

</div>

Also, the server routes are defined in [plugin.rb](https://github.com/kleinfreund/notebook/blob/main/plugin.rb) and reading from [this post](https://meta.discourse.org/t/creating-routes-in-discourse-and-showing-data/48827), I expected to see some calls to `{route}.json` from ember, but nothing.

I guess there is a wrapper somewhere in the discourse services, but I cannot find it.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [November 28, 2023, 11:24pm UTC](https://meta.discourse.org/t/difficulties-understanding-store-interactions-between-client-and-server/286859/3 "2023-11-28T23:24:30Z")

</div>

Do you need to add data to a new rails model, or are you adding stuff to existing ones? You can, for example, add\_to\_serializer.

It might help to share more details about what you’re trying to accomplish.

---

<div class="post-metadata">

### Author: ![Dimitrie\_David](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dimitrie_david/32/344465_2.png) [@Dimitrie\_David](https://meta.discourse.org/u/Dimitrie_David)
#### Post date: [November 28, 2023, 11:51pm UTC](https://meta.discourse.org/t/difficulties-understanding-store-interactions-between-client-and-server/286859/4 "2023-11-28T23:51:31Z")

</div>

First of all, I want to understand how the mechanism works. And I am referring to how does the store in ember.js call endpoints in rails.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [December 1, 2023, 12:44am UTC](https://meta.discourse.org/t/difficulties-understanding-store-interactions-between-client-and-server/286859/5 "2023-12-01T00:44:24Z")

</div>

Rails puts stuff in json that gets loaded by ember.

For me it’s easier to try to accomplish something and understand what’s required to accomplish that rather than understand the whole first.

You can read books on ember and rails if you want to understand it all.

I read a book on rails, which gave me some understanding of that. The ember side had taken me a long while to make any sense at all of ember.
