<!-- index.html -->
<html>
<head>
<!-- Do _not_ rely on this URL in production. Use only during development. -->
<script src="//netflix.github.io/falcor/build/falcor.browser.js"></script>
<script>
var model = new falcor.Model( {
source: new falcor.HttpDataSource( '/model.json' )
} ); // retrieve the "greeting" key from the root of the Virtual JSON resource
model.getValue( 'genreList[0].titles[0].name' )
.then( function ( json ) {
console.log( JSON.stringify( json, null, 3 ) );
} )
</script>
</head>
<body>
</body>
</html>
var falcorExpress = require( 'falcor-express' );
var falcor = require('falcor');
var express = require( 'express' );
var app = express(); var $ref = falcor.Model.ref;
var model = new falcor.Model({
cache: {
titleById: {
5221: {
name: "House of Cards",
rating: {$type: "atom", value: 5},
bookmark: {$type: "error", value: "Something went wrong."}
}
},
genreList: [
{
name: 'Recently Watched',
titles: [
$ref("titleById[5221]")
]
},
{
name: "New Releases",
titles: [
$ref("titleById[5221]")
]
}
]
}
}); app.use(express.static(__dirname + '/'));
app.use( '/model.json', falcorExpress.dataSourceRoute( function ( req, res ) {
return model.asDataSource();
} ) ); var server = app.listen(3131);

[Falcor] Return the data from server的更多相关文章

  1. [Angular 2] implements OnInit, OnDestory for fetching data from server

    Link: https://angular.io/docs/js/latest/api/core/OnInit-interface.html, https://www.youtube.com/watc ...

  2. zookeeper提示Unable to read additional data from server sessionid 0x

    配置zookeeper集群,一开始配置了两台机器server.1和server.2. 配置参数,在zoo.cfg中指定了整个zookeeper集群的server编号.地址和端口: server.1=1 ...

  3. ajax 通过return 返回data值

    方法例如以下: 1. ajax 必须为同步 设置async:false 2. 定一个局部变量 把data赋值给局部变量 然后 return 局部变量就可以 示比例如以下 function getEmp ...

  4. convert return char from sql server 2008 r2 or below version to c#

    C# string.Replace((char)13, ' ') //newline char; string.Replace((char)10, ' ') //return char;

  5. Retrieving data from a server

    A system includes a server and a controller embedded in a device. Both the server and the embedded c ...

  6. Using View and Data API with Meteor

    By Daniel Du I have been studying Meteor these days, and find that Meteor is really a mind-blowing f ...

  7. 基于Libevent的HTTP Server

    简单的Http Server 使用Libevent内置的http相关接口,可以很容易的构建一个Http Server,一个简单的Http Server如下: #include <event2/e ...

  8. [转]Installing SharePoint 2013 on Windows Server 2012 R2

    转自:http://www.avivroth.com/2013/07/09/installing-sharepoint-2013-on-windows-server-2012-r2-preview/ ...

  9. [CareerCup] 10.2 Data Structures for Large Social Network 大型社交网站的数据结构

    10.2 How would you design the data structures for a very large social network like Facebook or Linke ...

随机推荐

  1. java多线程心得

    多并发的时候,在什么情况下必须加锁?如果不加锁会产生什么样的后果. 加锁的场景跟java的new thread和Runnable的关系是什么? 看看java的concurrentMap源码. 还有sp ...

  2. DNS负载均衡

    1)DNS负载均衡的介绍 对于负载均衡的一个典型应用就是DNS负载均衡.庞大的网络地址和网络域名绝对是负载均衡体现优势的地方.那么它的具体原理是如何的呢?本文就将为大家详细介绍一下相关内容. DNS负 ...

  3. 数据库的事务处理必须满足ACID原则,ACID分别是指什么

    http://blog.csdn.net/dingxingmei/article/details/39270375

  4. PL/SQL中的变量案例解析

    1.标量: ag1: declare v_ename emp.ename%type;--自己称为单变量 begin select ename into v_ename from emp where e ...

  5. javaScript 自定义事件、发布订阅设计模式

    现在很多应用都允许用户根据自己的喜好订阅一些自己较为关注的信息,当应用更新了这些信息后将针对不同的订阅类型推送此类信息.例如xx招聘网,当你订阅了互联网IT技术相关分类的招聘信息推送后,当企业在该网站 ...

  6. access 2007 vba (亖)

    OpenReport方法执行 OpenReport 操作在 Visual Basic 中. 语法   表达式 .OpenReport(ReportName, View, FilterName, Whe ...

  7. zepto源码研究 - zepto.js - 5(dom属性管理)

    index: $.fn = {...... indexOf: emptyArray.indexOf,} index: function(element){ //这里的$(element)[0]是为了将 ...

  8. 单电机板机模型,f22

    视频连接 http://v.youku.com/v_show/id_XMTI5MDEzMzIxMg==.html?from=y1.7-1.2 http://v.youku.com/v_show/id_ ...

  9. PowerShell: 如何解决File **.ps1 cannot be loaded because the execution of scripts is disabled on this sy

    PowerShell 默认不允许执行*.ps1脚本文件.运行ps1文件会得到下面的错误: File C:\Temp\Test.ps1 cannot be loaded because the exec ...

  10. linux常用命令(5)rmdir命令

    rmdir是常用的命令,该命令的功能是删除空目录,一个目录被删除之前必须是空的.(注意,rm - r dir命令可代替rmdir,但是有很大危险性.)删除某目录时也必须具有对父目录的写权限.1.命令格 ...