利用 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.