Closed paul-hammant closed 2 years ago
the demo is using a in memory array to simulate database https://github.com/taowen/vue-db/blob/main/packages/demo-todo-server/src/index.ts#L8
The wire protocol can be RESTful http, it is provided via a callback https://github.com/taowen/vue-db/blob/main/packages/demo-todo-client/src/main.ts#L11 It is not too hard to write adapter for todobackend.com
https://github.com/taowen/vue-db/blob/main/packages/demo-todo-server/src/index.ts is not referencing vue-db because vue-db is pure client side library. Expose mysql table directly via http need to include a pretty large solution of authentication/authorization/pagination/data aggregation. It exceeds the scope of this tiny library.
But, vue-db defines a solid foundation for interactive client/server, designing with minimizing latency in mind:
$parent.id
is used as placeholder in dynamic criteria to allow follow up queries express it is relationship (either one-to-one or one-to-many). It is not full blown-up as GraphQL on purpose, as full GraphQL compliant server is hard to implement and hard to pursude people to adopt. It is much easier to "optimize" upon existing single table RESTful rpc api.I am working on vue-fusion as a layer upon vue-db to include server side code. But it is not targeting Web HTML5 technology. It is a SSR/OTA/HMR solution for wechat miniprogram.
Sounds good.
In demo-todo-server/src/index.ts, I can't see any use of vue-db. I thought that I would see a database (say sqlite), and some magic exposure of CRUD operations over the wire to the the client-side vue-db lib. Choice of wire precise URLs and GET/POST/PUT/DELETE is still a thing that the developer would architect themselves when using vue-db? And in this example, it would be possible to be compatible with todobackend.com's choices of RESTFUL webAPI (or impossible)?