Examples

25 views
Skip to first unread message

nick.go...@gmail.com

unread,
Oct 20, 2014, 11:10:57 PM10/20/14
to praxis-de...@googlegroups.com
i guess this is a feature request. Docs are great btw, but I was wondering if somebody could either setup a sample github app , preferably extracted from real life app, that deals with real life things like authentication, authorization, using DB layer like sequel or activerecord, caching, optimizations, pagination, hypermedia, etc or a series of screencasts would be awesome

Josep Blanquer

unread,
Oct 23, 2014, 1:49:54 PM10/23/14
to Nick Gorbikoff, praxis-de...@googlegroups.com
Nick,

 We have started to put a simple, but featureful enough, app for exactly those reasons. Some sort of simple Blog app that can showcase (over time) a lot of the real things.

I am not sure when we'll have time to get that out somewhere, but I'm hoping that the initial one will be sooner than later. (It's simply a matter of time allocation :) ) So, stay tuned.

Cheers,

Josep M.

On Mon, Oct 20, 2014 at 8:10 PM, <nick.go...@gmail.com> wrote:
i guess this is a feature request. Docs are great btw, but I was wondering if somebody could either setup a sample github app , preferably extracted from real life app, that deals with real life things like authentication, authorization, using DB layer like sequel or activerecord, caching, optimizations, pagination, hypermedia, etc or a series of screencasts would be awesome

--
You received this message because you are subscribed to the Google Groups "praxis-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to praxis-developm...@googlegroups.com.
To post to this group, send email to praxis-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/praxis-development/5be6d2fb-d484-4e9f-b956-ac43fa9ea1c7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

nick gorbikoff

unread,
Oct 23, 2014, 6:21:07 PM10/23/14
to Josep Blanquer, praxis-de...@googlegroups.com
Example suggestion - I actually liked how easy it was to implement in Praxis compared to other frameworks


Default response layout.
 I like how praxis lets you define body of the response completely. But I'd like to suggest a "default" response structure like so as an example of its flexibility. Something I implemented in my app which is something required by my JS client consuming API. It showcases flexibility of response, use of kaminari, and ransack for pagination and searching. Compared to grape this tooke me all fo 10 mins to setup, but in grape I head to use 2 extra gems to do that and it was to figure out how they work and to get them to work with my setup.

in dealers controller index action 

      @q = DCustomer.ransack(params[:q].to_h)
      @customers = @q.result().includes(:addresses, :phones).order(params[:order]).page(params[:page]).per(params[:per])

response.body = respond_wtih(params: params, object: @customers)

respond_with returns a hash structure

which in turn results in a json structure like this when I make a request like this
( I searches for all customers that a have a zip code of 60139 in a polymorphic model Address) 



{"meta": {"count": 8,"offset": 0,"limit": 10,"currnet_page": 1,"request": {"order": null,"page": null,"per": null,"q": {"addresses_zip_eq": "60139"}}},"payload": [ { "id: 1, "code": "CoolD", "name": "CoolDealer, Global Inc }]}


--
--------------------------------------

Nick Gorbikoff
nick.go...@gmail.com
Reply all
Reply to author
Forward
0 new messages