Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,745 changes: 1,015 additions & 730 deletions CHANGELOG.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ def add_webhook_controller
end

def add_webhook_route
route = "\t\t\tpost '#{file_name}', to: '#{file_name}#receive'\n"
inject_into_file("config/routes.rb", route, after: /namespace :webhooks do\n/)
route "post '#{file_name}', to: '#{file_name}#receive'", namespace: :webhooks
end

private
Expand Down
4 changes: 4 additions & 0 deletions lib/generators/shopify_app/install/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ def mount_engine
route("mount ShopifyApp::Engine, at: '/'")
end

def setup_routes
route "# Add your webhook routes here\n", namespace: [:webhooks]
end

def insert_hosts_into_development_config
"Rails.application.configure do\n"
.then { insert_tunnel_host_rules("ngrok", _1, NGROK_HOST + "\n") }
Expand Down
33 changes: 0 additions & 33 deletions lib/generators/shopify_app/routes/routes_generator.rb

This file was deleted.

12 changes: 0 additions & 12 deletions lib/generators/shopify_app/routes/templates/routes.rb

This file was deleted.

13 changes: 7 additions & 6 deletions test/app_templates/config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@
get :count
end
end
namespace :webhooks do
post "/app_uninstalled", to: "app_uninstalled#receive"
post "/customers_data_request", to: "customers_data_request#receive"
post "/customers_redact", to: "customers_redact#receive"
post "/shop_redact", to: "shop_redact#receive"
end
end

namespace :webhooks do
post "/app_uninstalled", to: "app_uninstalled#receive"
post "/customers_data_request", to: "customers_data_request#receive"
post "/customers_redact", to: "customers_redact#receive"
post "/shop_redact", to: "shop_redact#receive"
end

mount ShopifyApp::Engine, at: "/"
Expand Down
7 changes: 5 additions & 2 deletions test/dummy/config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# frozen_string_literal: true

Rails.application.routes.draw do
mount ShopifyApp::Engine, at: "/"
root to: "dummy_home#index"
root :to => 'dummy_home#index'
namespace :webhooks do
# Add your webhook routes here
end
mount ShopifyApp::Engine, at: '/'
end
26 changes: 0 additions & 26 deletions test/generators/routes_generator_test.rb

This file was deleted.

Loading