Tim Uckun
2017-09-24 07:57:54 UTC
I am writing an API in sinatra. It will be a pure JSON api so I need to
parse the body as JSON and I am wondering whether it's more efficient to do
that with a middleware or as a before hook?
Also a question about the general setup. I will have public paths and
private paths and I will be using JWT. One approach is to create a
namespace for the private and as a before or use setting make sure the JWT
exists and is valid. Another approach would be to create two apps one for
the private and one for the public and mount them on different paths. Is
one way more efficient than the other?
Finally. How about I group similar functionality into a separate app and
have many apps each of which inherits from a base app but is mounted on
different paths. Does Sinatra initialize all the classes on every request
or only initialize them when the mounted path is hit?
Thanks.
parse the body as JSON and I am wondering whether it's more efficient to do
that with a middleware or as a before hook?
Also a question about the general setup. I will have public paths and
private paths and I will be using JWT. One approach is to create a
namespace for the private and as a before or use setting make sure the JWT
exists and is valid. Another approach would be to create two apps one for
the private and one for the public and mount them on different paths. Is
one way more efficient than the other?
Finally. How about I group similar functionality into a separate app and
have many apps each of which inherits from a base app but is mounted on
different paths. Does Sinatra initialize all the classes on every request
or only initialize them when the mounted path is hit?
Thanks.
--
You received this message because you are subscribed to the Google Groups "sinatrarb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sinatrarb+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "sinatrarb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sinatrarb+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.