0.0
No commit activity in last 3 years
No release in over 3 years
A Syro extension to resolve paths from a container.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.10
~> 10.0
>= 0

Runtime

 Project Readme

Syro::Container

Gem Build Status Test Coverage Code Climate Inline docs

A Syro Deck extension that allows it to register and resolve routes from a container.

Usage

Add this line to your application's Gemfile:

gem 'syro-container'

Include it in your Syro::Deck

require 'syro/container'

class MyApp < Syro::Deck
  include Syro::Container
end

Register your sub-apps in your container:

subapp = Syro.new {
  # Your app code here
  on('innerpath') {
    get {
      res.write "Hello, world!"
    }
  }
}

MyApp.register('subapp', subapp)

Access your subapp from the main app:

app = Syro.new(MyApp)

env = {
  "REQUEST_METHOD" => "GET",
  "PATH_INFO"      => "/subapp/innerpath"
}
p app.call(env)
#=> [200, {"Content-Length"=>"13", "Content-Type"=>"text/html"}, ["Hello, world!"]]

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/sagmor/syro-container. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.