Make Web engine an isolated namespace engine mounted on / (without /web prefix)

This approach is better to separate concerns, see “Isolated Engine” here: https://api.rubyonrails.org/v3.2/classes/Rails/Engine.html
This commit is contained in:
luisramos0
2018-09-25 12:34:38 +01:00
parent c22ac0086b
commit a23b1b980d
3 changed files with 5 additions and 6 deletions

View File

@@ -1,6 +1,6 @@
Darkswarm.controller "CookiesBannerCtrl", ($scope, CookiesBannerService, $http, $window)->
$scope.acceptCookies = ->
$http.post('/web/api/cookies/consent')
$http.post('/api/cookies/consent')
CookiesBannerService.close()
CookiesBannerService.disable()

View File

@@ -1,9 +1,7 @@
Web::Engine.routes.draw do
namespace :web do
namespace :api do
scope '/cookies' do
resource :consent, only: [:show, :create, :destroy], controller: "cookies_consent"
end
namespace :api do
scope '/cookies' do
resource :consent, only: [:show, :create, :destroy], controller: "cookies_consent"
end
end
end

View File

@@ -1,4 +1,5 @@
module Web
class Engine < ::Rails::Engine
isolate_namespace Web
end
end