利用 Derby MVC 构建实时和协作的应用
The Derby MVC framework 可以很方便实现编写实时,协作的应用。能够运行在Node.js和浏览器环境中。
Derby包含一个强大的数据同步引擎叫Racer,能够自动在浏览器,服务器和数据库之间同步数据。模型可以订阅特定对象的变化,从而实现数据传播的细粒度控制。 Racer支持离线使用。它能够极大的简化多用户应用的开发。
Features
-
HTML templates: Handlebars-like templates are rendered into HTML on both the server and client. Because they render on the server, pages display immediately—even before any scripts are downloaded. Templates are mostly just HTML, so designers can understand and modify them.
-
View bindings: In addition to HTML rendering, templates specify live bindings between the view and model. When model data change, the view updates the properties, text, or HTML necessary to reflect the new data. When the user interacts with the page—such as editing the value of a text input—the model data updates.
-
Client and server routing: The same routes produce a single-page browser app and an Express server app. Links render instantly with push/pop state changes in modern browsers, while server rendering provides access to search engines and browsers without JavaScript.
-
Model syncing: Model changes are automatically synchronized with the server and all clients subscribed to the same data over Socket.IO.
-
Customizable persistence: Apps function fully with in-memory, dynamic models by default. Apps can also use the racer-db-mongo plugin to add MongoDB support with no change to the application code. Any changes to data made within the app are automatically persisted. Adding support for other databases is simple.
-
Conflict resolution: The server detects conflicts, enabling clients to respond instantly and work offline. Multiple powerful techniques for conflict resolution are included.