Module: Liberty
- Defined in:
- lib/liberty.rb,
lib/liberty/cors.rb,
lib/liberty/router.rb,
lib/liberty/version.rb,
lib/liberty/endpoint.rb,
lib/liberty/application.rb,
lib/liberty/router/node.rb,
lib/liberty/router/trie.rb,
lib/liberty/router/printer.rb,
lib/liberty/cors/middleware.rb,
lib/liberty/adapters/request.rb,
lib/liberty/adapters/response.rb,
lib/liberty/adapters/parsers/json.rb,
lib/liberty/adapters/parsers/null.rb,
lib/liberty/adapters/parsers/factory.rb
Defined Under Namespace
Modules: Adapters
Classes: Application, CORS, Endpoint, Router
Constant Summary
collapse
- VERSION =
"0.2.1"
Class Method Summary
collapse
Class Method Details
.add_endpoint(verb:, path:, endpoint_class:) ⇒ Object
27
28
29
30
|
# File 'lib/liberty.rb', line 27
def self.add_endpoint(verb:, path:, endpoint_class:)
app = Application.new(endpoint_class: endpoint_class)
router.public_send(verb, path, to: app)
end
|
.middleware ⇒ Object
20
21
22
23
24
25
|
# File 'lib/liberty.rb', line 20
def self.middleware
@middleware ||= Rack::Builder.new(Liberty.router) do
use(Liberty::CORS::Middleware)
use(Rack::AbstractFormat)
end
end
|
.rack_app ⇒ Object
16
17
18
|
# File 'lib/liberty.rb', line 16
def self.rack_app
middleware
end
|
.router ⇒ Object
32
33
34
|
# File 'lib/liberty.rb', line 32
def self.router
@router ||= Liberty::Router.new
end
|