shopify-routes

11 views
Skip to first unread message

Travis

unread,
May 24, 2012, 3:57:14 PM5/24/12
to shopify-api
In most of my Shopify apps I end up having to write routes for
redirecting the user back to Shopify. Usually to the shop's admin
page, or the products, or orders pages. I kept adding to the list of
routes I would include in config/routes.rb, and it started getting
rather sloppy. So I wrote this gem so I could do this in my config/
routes.rb:

namespace :shopify do
ShopifyAPI.routes self, only: [:products, :orders]
end

Then I'd have these paths available to use in my app:

shopify_products_url
shopify_orders_url

The gem is published if anybody wants to use it. Just include shopify-
routes in your Gemfile. The code and docs are on Github here:

https://github.com/travishaynes/shopify-routes

It's really early in development. I haven't written the tests for it,
yet. The gem just kind of evolved naturally as I was writing other
apps, so any feedback would be appreciated!

Dave

unread,
May 24, 2012, 4:38:24 PM5/24/12
to shopi...@googlegroups.com
Handy! I will fork that idea and make myself a handy Sinatra module providing that for my Apps too. Will keep that public when I do...

I am also tired of always having to keep track of the relevant Shop URL to return someone to from within the App code... thanks!

David Underwood

unread,
May 29, 2012, 3:38:21 PM5/29/12
to shopi...@googlegroups.com
Hey Travis,

That looks great! When you're happy with your code we'd love to see a pull request including the gem in shopify_app.

-David Underwood
 Developer Advocate, Shopify
Reply all
Reply to author
Forward
0 new messages