Reactive REST API?

I’m not sure if it’s correct wording Reactive API

I just want to ask, when we add a record into collection, let’s say, posts, is there a way to automatically reload for its API <url>/api/posts ?

This can be a not correct question, so please correct me.
I don’t even know if there’s a need for that, I’m just wondering, if we say the app reactive, to which extent it’s reactive (realtime)?

If it’s doable, then which Meteor package can realise that?

well, the route link is universal
But if you want after adding new record to be redirected to it, you normaly do it this way.

you fill the form
now u expect redirect if it successfully inserted
so you add to that saving method call callback which redirect you.
exact commands depends on your call and which router you use.

I didn’t get why it has to do with redirection?

Let me clarify on the app I’ve just made

Let’s use 2 browsers: Chrome and Firefox.

In Firefox you access

In Chrome, you create a post. So, once a post created it show one post more in json format at in Firefox.

Does it make sense? :slight_smile:

Well, REST API is accessed using 1 HTTP call, browser waits for response and it is done. There is no reactivity.
It is simple http request.


Rest APIs work over HTTP. That means you can’t “reactively” update it. You request the data, wait for a success or fail callback, and then use the data in those.

Usually you use sockets to connect and request updates.

1 Like

Can you please give some examples on this?

For a reactive API you need DDP. What type of client is consuming this API? DDP clients have been implemented for most modern languages/platforms.

1 Like