Class: HelixWebServices::Master

Inherits:
Sinatra::Base
  • Object
show all
Defined in:
lib/helix_web_services.rb

Overview

A master Sinatra instance that basically sets up routing to each of the sub-applications, and connects the authorization mechanism.

In the future, we may have status and health check functionality available here.

We mount each application under a “versioned” subpath. This allows us to keep an old and new version of a sub-application in the system at the same time, ideally to allow for migration to breaking changes.

Class Method Summary (collapse)

Class Method Details

+ (Object) register_app(app)



111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/helix_web_services.rb', line 111

def register_app(app)
  use app
  app.register HelixWebServices::ErrorHandling
  app.before do
    content_type 'application/json'
    headers['X-Helix-Web-Services-Version'] = HelixWebServices::PRODUCT_ID
  end
  app.helpers HWSHelpers
  app.not_found do
    status 404
    ''
  end
end