更新:在我的帖子下,我找到了非常有用的评论,想要与您分享作为主要内容的补充:
关于缺乏示例,您可以在awesome-falcorjs存储库中找到有用的用户,其中包含Falcor的不同CRUD使用示例:
https://github.com/przeor/awesome-falcorjs ... 第二件事,有一本名为“Mastering Full Stack React Development”的书,其中也包括了Falcor(学习如何使用它的好方法):
以下是原始帖子:
FalcorJS (https://www.facebook.com/groups/falcorjs/)比Relay/GraphQL更简单高效。
GraphQL+Relay的学习曲线非常陡峭:
简而言之,选择Falcor。在下一个项目中使用Falcor,直到您拥有大量预算和团队学习时间,然后再使用RELAY+GRAPHQL。
GraphQL+Relay有巨大的API,您必须熟练掌握。Falcor的API很小,非常容易被任何熟悉JSON的前端开发人员掌握。
如果您的敏捷项目资源有限->那么选择FalcorJS!
我主观的看法是:FalcorJS在全栈JavaScript中要比传统方法容易500%以上。
我还发布了一些FalcorJS入门套件(以及更多全栈falcor示例项目):https://www.github.com/przeor
更多的技术细节如下:
1)当您使用Falcor时,可以在前端和后端同时使用:
import falcor from 'falcor';
然后基于此构建您的模型。
... 您还需要两个简单易用的库来在后端使用:
a) falcor-express - 您只需使用一次即可(例如app.use('/model.json', FalcorServer.dataSourceRoute(() => new NamesRouter())))。来源:https://github.com/przeor/falcor-netflix-shopping-cart-example/blob/master/server/index.js
b) falcor-router - 在那里您定义简单的路由(例如route: '_view.length')。来源:
https://github.com/przeor/falcor-netflix-shopping-cart-example/blob/master/server/router.js
学习曲线方面,Falcor非常容易上手。
您还可以查看比FB的lib更简单的文档,并且还可以查看文章“为什么您应该关注falcorjs(netflix falcor)”。
2) Relay/GraphQL更像是一个巨大的企业工具。
例如,您有两个不同的文档,分别讨论:
a) Relay: https://facebook.github.io/relay/docs/tutorial.html
-容器
-路由
-根容器
-就绪状态
-突变
-网络层
-Babel Relay插件
-GRAPHQL
- GraphQL Relay规范
- 对象标识
- 连接
- 突变
- 进一步阅读
API参考
Relay
- RelayContainer
- Relay.Route
- Relay.RootContainer
- Relay.QL
- Relay.Mutation
- Relay.PropTypes
- Relay.Store
接口
RelayNetworkLayer
- RelayMutationRequest
- RelayQueryRequest
b) GraphQL: https://facebook.github.io/graphql/
- 2Language
- 2.1Source Text
- 2.1.1Unicode
- 2.1.2White Space
- 2.1.3Line Terminators
- 2.1.4Comments
- 2.1.5Insignificant Commas
- 2.1.6Lexical Tokens
- 2.1.7Ignored Tokens
- 2.1.8Punctuators
- 2.1.9Names
- 2.2Query Document
- 2.2.1Operations
- 2.2.2Selection Sets
- 2.2.3Fields
- 2.2.4Arguments
- 2.2.5Field Alias
- 2.2.6Fragments
- 2.2.6.1Type Conditions
- 2.2.6.2Inline Fragments
- 2.2.7Input Values
- 2.2.7.1Int Value
- 2.2.7.2Float Value
- 2.2.7.3Boolean Value
- 2.2.7.4String Value
- 2.2.7.5Enum Value
- 2.2.7.6List Value
- 2.2.7.7Input Object Values
- 2.2.8Variables
- 2.2.8.1Variable use within Fragments
- 2.2.9Input Types
- 2.2.10Directives
- 2.2.10.1Fragment Directives
- 3Type System
- 3.1Types
- 3.1.1Scalars
- 3.1.1.1Built-in Scalars
- 3.1.1.1.1Int
- 3.1.1.1.2Float
- 3.1.1.1.3String
- 3.1.1.1.4Boolean
- 3.1.1.1.5ID
- 3.1.2Objects
- 3.1.2.1Object Field Arguments
- 3.1.2.2Object Field deprecation
- 3.1.2.3Object type validation
- 3.1.3Interfaces
- 3.1.3.1Interface type validation
- 3.1.4Unions
- 3.1.4.1Union type validation
- 3.1.5Enums
- 3.1.6Input Objects
- 3.1.7Lists
- 3.1.8Non-Null
- 3.2Directives
- 3.2.1@skip
- 3.2.2@include
- 3.3Starting types
- 4Introspection
- 4.1General Principles
- 4.1.1Naming conventions
- 4.1.2Documentation
- 4.1.3Deprecation
- 4.1.4Type Name Introspection
- 4.2Schema Introspection
- 4.2.1The "__Type" Type
- 4.2.2Type Kinds
- 4.2.2.1Scalar
- 4.2.2.2Object
- 4.2.2.3Union
- 4.2.2.4Interface
- 4.2.2.5Enum
- 4.2.2.6Input Object
- 4.2.2.7List
- 4.2.2.8Non-null
- 4.2.2.9Combining List and Non-Null
- 4.2.3The __Field Type
- 4.2.4The __InputValue Type
这是您的选择:
简单、简洁、文档详尽的Falcor JS,与长而高级的GraphQL&Relay等企业级工具相比。
正如我之前所说,如果您是一个掌握使用JSON思想的前端开发人员,那么Falcor团队的JSON图实现是做全栈开发项目的最佳方式。