Netflix / falcor

A JavaScript library for efficient data fetching

Home Page:http://netflix.github.io/falcor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Q] What is the response format of Falcor endpoint?

duongphuhiep opened this issue · comments

Hello,

I want to implement the falcor backend on other languages (Golang / Python / PHP...)

Could you please get me to the documentation which describes the format of responses from a falcor backend?

Eg:
for the request:
http://myapi.com/model.json?paths=[["productById",15,"name"]]&method=get
(which is fired by HttpDataSource: model.getValue(["productById", 15, "name"]))

my server response

{
  "jsonGraph": {
    "$type": "atom",
    "value": "nexus"
  }
}

But falcor didn't like this response, so what should I return?

Thank you

Response format must be the same shape as the data:

{
  jsonGraph: {
    productById: {
      15: {
         name: "nexus"
       }
    }
  },
  paths: [
    ["productById", 15, "name"]
  ]
}

Please see the documentation for more examples. There is a sample Router at http://github.com/netflix/falcor-router-demo

it works, thanks!

it is quite a challenge to build / manipulate Falcor graph in other technologies. (we likely have to build the FalcorExpress ourself)

Anyway, Falcor is fantastic.

Thank you very much