README.md in rack-app-0.2.0 vs README.md in rack-app-0.2.1

- old
+ new

@@ -1,15 +1,21 @@ -# Rack::App +# Rack::APP -Super bare bone Rack::App for writing minimalist/masochist rack apps +Your next favourite rack based micro framework that is totally addition free! +Have a cup of awesomeness with your to performance designed framework! The idea behind is simple. -Have a little framework that can allow you write pure rack apps, +Keep the dependencies and everything as little as possible, +while able to write pure rack apps, that will do nothing more than what you defined. -This includes that it do not depend on fat libs like activesupport. - +If you want see fancy magic, you are in a bad place buddy! +This includes that it do not have such core extensions like activesupport that monkey patch the whole world. + +Routing can handle large amount of endpoints so if you that crazy to use more than 10k endpoint, +you still dont have to worry about response speed. + ## Installation Add this line to your application's Gemfile: ```ruby @@ -29,46 +35,87 @@ config.ru ```ruby require 'rack/app' +require_relative 'lib/bootstrap' + class YourAwesomeApp < Rack::APP + mount AwesomeController + get '/hello' do 'Hello World!' end get '/nope' do request.env response.write 'some response body' - end - post '/lol_post' do + post '/lol_post_fail' do status 500 'LOL' end - + + get '/users/:user_id' do + params['user_id'] + end + + post '/some/endpoint/for/the/rabbit/:queue_name' do + mq_request # helper are the class instance method + end + + def mq_request + q = BUNNY_CONN_CHANNEL.queue(params['queue_name']) + BUNNY_CONN_CHANNEL.default_exchange.publish(request.body.read, :routing_key => q.name) + end + end run YourAwesomeApp ``` +you can access Rack::Request with the request method and +Rack::Response as response method. + +By default if you dont write anything to the response 'body' the endpoint block logic return will be used + +## Example Apps To start with + +* [Basic](https://github.com/adamluzsi/rack-app.rb-examples/tree/master/basic) + * bare bone simple example app + +* [Escher Authorized Api](https://github.com/adamluzsi/rack-app.rb-examples/tree/master/escher_authorized) + * complex authorization for corporal level api use + ## TODO -* benchmark for rails, padrino, sinatra, grape etc to prove awesomeness +* benchmark for rails, padrino, sinatra, grape etc to prove awesomeness in term of speed * more verbose readme * drink less coffee -* support restful endpoints - * params - * route-matching +## Roadmap + +### 0.3.0 + +* add TESTING module for rspec helpers that allow easy to test controllers + +### 0.4.0 + +* serializer block/method for class shared serialization logic + +### 0.5.0 + +* content_type syntax sugar on class level +* response_headers syntax sugar for request processing + ## Development After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org). ## Contributing -Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/rack-app. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct. +Bug reports and pull requests are welcome on GitHub at https://github.com/adamluzsi/rack-app.rb This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.