geddy / model

Datastore-agnostic ORM in JavaScript
265 stars 55 forks source link

Client side RESTfull adapter #121

Open der-On opened 10 years ago

der-On commented 10 years ago

It would be very cool to have a client side adapter that is based on restfull routes.

This way one could write almost the same code in frontend and backend and also share the models.

I would give this a try if you could give me tips on how to write adapters.

der-On commented 10 years ago

I've kind of started to hack such a thing in. However completely outside of the model module. After some thinking I guess it should provide a RESTfull adapter for the server too.

On the client it actually does not work because of "require('./logger')" in the utilities module. Browserify is not able to resolve this require. (I've first started by copying over the in-memory adapter)

mde commented 10 years ago

Here's what the adapter interface should support: https://github.com/mde/model/blob/master/lib/adapters/base_adapter.js If you'll start a branch, we can chime in with suggestions.

der-On commented 10 years ago

Cool. Gonna see if I can put it to use on both client and server.

der-On commented 10 years ago

Bookmark: https://github.com/visionmedia/superagent This could be used to do the http request stuff on client and server side and thus make it work in both worlds.