[BNM] Json API response formats

Alex Peckham alexpeckham at gmail.com
Fri Jul 24 21:15:19 BST 2015


Hmm I've been meaning to give sails a try, at the moment I generally use
node/express/mongo server-side with additional node modules as required.

One thing I'm not sure about sails-wise though is how scaling works. Like
if I wanted to use cluster on a single machine with multiple CPUs, or to
load balance requests to several node instances, I'm not sure if sails
would make that easier or harder?

At the moment I have very granular control over how scaling goes and sails
is a bit of an unknown quantity to me in that respect. I find often I can
structure things in such a way that I don't need shared state, sticky
sessions, etc. And I feel with sails some things like this might become
more like requisites. Although having not worked with it I could be wrong!

I think I'm somewhat minimalist in my approach which has meant I've not
given it a try yet..

Alex







On Friday, 24 July 2015, Wayne Douglas <wayne at sonatribe.com> wrote:

> I've been working with sails js for node api's and it can do json api
> standard responses if you add the ember blueprints. You never have to
> consider this stuff again. Really nice :)
> On Fri, 24 Jul 2015 at 19:58 Alex Peckham <alexpeckham at gmail.com
> <javascript:;>> wrote:
>
> > For me it depends on the project. Like if I'm writing something
> > server-side that is only ever hit by a mobile app that I'm also writing
> I'd
> > probably not use status codes and just return the error in the JSON with
> a
> > 200 OK. Then the app just parses the JSON like always and invokes the
> > relevant code to handle it, without needing to also parse the status
> code.
> >
> > However, if I'm writing something where I have less idea about what
> clients
> > might be hitting it, I'd generally go with the most appropriate status
> code
> > and a more detailed error in JSON if needed.
> >
> > Finally any authentication-related errors I would always indicate with
> > status code and an empty response body in either situation, to avoid
> > leaking any info that might be of use to a would-be attacker.
> >
> >
> > Alex
> >
> > On Friday, 24 July 2015, Julian Blundell <julian.blundell at gmail.com
> <javascript:;>>
> > wrote:
> >
> > > Hi Helena
> > >
> > > There are standard http return codes, 200 for success, 400 for failure
> > etc
> > >
> > > http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
> > >
> > > Recommended using them, most api libraries implement them
> > >
> > > Jules
> > > On 24 Jul 2015 12:26 pm, "Helana Bryant" <spiralwarp at gmail.com
> <javascript:;>
> > > <javascript:;>> wrote:
> > >
> > > > Any preference?
> > > >
> > > >
> > > >
> > >
> >
> http://stackoverflow.com/questions/12806386/standard-json-api-response-format
> > > > --
> > > >
> > > > BNM Subscribe/Unsubscribe:
> > > > http://www.brightonnewmedia.org/options/bnmlist
> > > >
> > > > BNM members often work together in the real world at:
> > > > http://www.theskiff.org
> > > >
> > > > BNM powered by Wessex Networks:
> > > > http://www.wessexnetworks.com
> > > >
> > > --
> > >
> > > BNM Subscribe/Unsubscribe:
> > > http://www.brightonnewmedia.org/options/bnmlist
> > >
> > > BNM members often work together in the real world at:
> > > http://www.theskiff.org
> > >
> > > BNM powered by Wessex Networks:
> > > http://www.wessexnetworks.com
> > >
> > --
> >
> > BNM Subscribe/Unsubscribe:
> > http://lists.brightonnewmedia.org/options/bnmlist
> >
> > BNM members often work together in the real world at:
> > http://www.theskiff.org
> >
> > BNM powered by Wessex Networks:
> > http://www.wessexnetworks.com
> >
> --
>
> BNM Subscribe/Unsubscribe:
> http://lists.brightonnewmedia.org/options/bnmlist
>
> BNM members often work together in the real world at:
> http://www.theskiff.org
>
> BNM powered by Wessex Networks:
> http://www.wessexnetworks.com
>


More information about the BNMlist mailing list