--
You received this message because you are subscribed to the Google Groups "LoopbackJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to loopbackjs+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/loopbackjs/fd7cf104-8301-43b8-a79b-beeed1916ce2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
On Jul 21, 2015, at 10:12 AM, sprhawk <spr...@gmail.com> wrote:
Thank you.I want to ask one another question.Is loopback more like client centric, not server centric.
I mean whether in loopback, best practices are developers do simple server tasks such as create model. leave more tasks to do in client side ?
If so, is this approach less manageable ? client developers have more responsibilities to do the job done ?But it also cause many logics are done in client side which caused less flexible when the system is online ?
On Tuesday, July 21, 2015 at 11:15:43 PM UTC+8, sprhawk wrote:For now I think loopback is great for simple model and apisBut in real life the situation is more complex. I want some best practices for two examples.First,Say I want to send a post to a timelineI need some metadata ( content , tags, author, related friends) and one or more media.If in an express backend, I can just handle all the request and do some post-process before creation ( eg, image processing ).But in loopback I need to upload via component-storage service then a client (Client SDK all operate on the model object via REST ) need to handle how to reference the images from Post instance.When I get the list of posts, an express backend can do pre-process, eg transform image reference with a real / CDN cached image url, but I think loopback may do it naively ( with file object by component-storage ) ?So can I do this more intuitively ( like an express backend do ? )Second, nosql db can construct model more complex, eg embeded document. Say I save all image references in Post instance as embeded documents. But in loopback it cannot change the embeded document easily ? So I have to do it more like a sql db ?I am struggling with image upload and complex model for many days.For now I concluded loopback is pretty good for simple model / api generation but not much customizable.Due to loopback doesn't expose many internal APIs ( such as database api, request handling hook , so I cannot hack it ), only one or two reasons can cause I to drop it.The only reason I need loopback for now is its built-in ACL and user mechanism.
--
You received this message because you are subscribed to the Google Groups "LoopbackJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to loopbackjs+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/loopbackjs/43b12fda-04cf-431a-9026-f97a870cd7d4%40googlegroups.com.
Book.upload = function(file, cb) {
console.log(file);
cb(null, file);
};
Book.remoteMethod('upload', {
"accepts": [{arg: 'epub', type: 'file'}],
"returns": {},
"http": {verb: 'post'}
});