<!-- 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. linux执行文件命令

    1.如果path中有你的程序所在的目录,那么直接执行filename即可 2.如果path中没有程序所在目录,那么进入目录./filename或者path/filename 比如 wj@ubuntu: ...

  2. spring aop原理分析

    持续更新... aop跟java代理模式有关. java.lang.reflect.Proxy java.lang.reflect.InvocationHandler 工厂模式用到java反射. ao ...

  3. apache 2.4 You don't have permission to access / on this server

    用的2.4版本,以前版本解决: 马上打开apache的配置文件httpd.conf,逐行检查.在大约快一半的地方有以下这段代码: <Directory />    Options Foll ...

  4. 自动加载类PHP中spl_autoload_register函数的用法

    spl_autoload_register(PHP 5 >= 5.1.2) spl_autoload_register — 注册__autoload()函数 说明bool spl_autoloa ...

  5. 转 常用JQuery插件整理

    虽然自己也写过插件,但JQuery插件种类的繁多,大多时候,我还是使用别人写好的插件,这些都是我用了同类插件里较为不错的一些,今天就整理一下公开放出来. UI: jquery.HooRay(哈哈,自己 ...

  6. webuploader文件上传问题总结

    webuploader百度的一个很好的上传文件插件: 选择它的原因: 1.浏览器兼容性好,支持IE8,这是我最主要的,好多上传插件都不支持: 2.跨域访问,因为我的上传需要到图片服务器上,这就需要跨域 ...

  7. Ubuntu12.04 下安装Chrome浏览器

    第一步 下载. 32位:https://dl.google.com/linux/direct/google-chrome-stable_current_i386.deb 64位:https://dl. ...

  8. c# 6.0 学习笔记

    refer : http://www.cnblogs.com/yinrq/p/5600530.html http://www.cnblogs.com/wolf-sun/p/5168217.html h ...

  9. poj 3277 Mountains

    http://poj.org/problem?id=3227 #include <cstdio> #include <cstring> #include <cmath&g ...

  10. GitHub 如何基於 Node.js 和 Chromium 開發 Atom?

    看到回答里, 多数都没有回答到点子上, 还有些给了非常主观的意见而没有给出实际结论和分析过程. 题主的问题有四个: 1. Github 如何基于 Node.js 和 Chromium 开发 Atom? ...