帮酷LOGO
  • 显示原文与译文双语对照的内容
文章标签:数据  HOST  Hosting  Source  Express  EXP  fal  中间件  
Express Middleware for Hosting Falcor Data Sources.

  • 源代码名称:falcor-express
  • 源代码网址:http://www.github.com/Netflix/falcor-express
  • falcor-express源代码文档
  • falcor-express源代码下载
  • Git URL:
    git://www.github.com/Netflix/falcor-express.git
  • Git Clone代码到本地:
    git clone http://www.github.com/Netflix/falcor-express
  • Subversion代码到本地:
    $ svn co --depth empty http://www.github.com/Netflix/falcor-express
    Checked out revision 1.
    $ cd repo
    $ svn up trunk
  • falcor-express

    面向 falcor-express的服务器中间件

    netflix/falcor-express-demo基本再现的工作用法示例

    用法

    简约示例

    var FalcorServer =require('falcor-express');var bodyParser =require('body-parser');var express =require('express');var app =express();var TestRouter =<your router here>;app.use(bodyParser.text({ type:'text/*' }))app.use('/model.json', FalcorServer.dataSourceRoute(function(req, res) {
     returnnewTestRouter();
    }));app.use(express.static('.'));var server =app.listen(9090, function(err) {
     if (err) {
     console.error(err);
     return;
     }
     console.log("navigate to http://localhost:9090")
    });

    使用 static 模型的示例( 仅用于开发目的)

    var falcor =require('falcor');var FalcorServer =require('falcor-express');var bodyParser =require('body-parser');var express =require('express');var app =express();var model =newfalcor.Model({
     cache: {
     todos: [
     {
     name:'get milk from corner store',
     done:false },
     {
     name:'withdraw money from ATM',
     done:true }
     ]
     }
    });app.use(bodyParser.text({ type:'text/*' }))app.use('/model.json', FalcorServer.dataSourceRoute(function(req, res) {
     returnmodel.asDataSource();
    }));app.use(express.static('.'));var server =app.listen(9090, function(err) {
     if (err) {
     console.error(err);
     return;
     }
     console.log("navigate to http://localhost:9090")
    });

    插件开发

    在贡献之前,请运行linter和测试,以确保没有问题。

    npm run lint

    npm run test


    文章标签:数据  Source  EXP  expr  Express  HOST  中间件  Hosting  

    Copyright © 2011 HelpLib All rights reserved.    知识分享协议 京ICP备05059198号-3  |  如果智培  |  酷兔英语