View
304
Download
2
Category
Tags:
Preview:
Citation preview
RACKa framework to roll your own
@nishantmodak
Revealing Hour Creations
t
revealinghour.in
Donald Knuth
Email is a wonderful thing for people whose role in life is to be on top of things. But not for me; my role is to be on the bottom of things.http://www-cs-faculty.stanford.edu/~knuth/email.html
SERVER
What is Rack?
APPLICATION / FRAMEWORK
SERVER
1. Web Server Interface 2. Tool for composing web applications 3. Collection of middleware utilities
What is Rack?
RACK
config.ru
$ rackup
APP
HTTP
INTERMEDIARIES
Middleware
HTTP
APPLICATION
M I D D L E W A R E
DSL use, run, map
lib/builder.rb
DEMO
1. MyRackApp
2. Middlewares - use / run / map
3. Rack Code
Rack::Builder
> rake middleware
MIDDLEWARE
MIDDLEWARE
MIDDLEWARE
ROUTING
MIDDLEWARE APPLICATION
APPLICATION
SERVER
FRAMEWORK
Yay! Full Stack Developers!
WHY ANOTHER FRAMEWORK ?
Yes, We CAN !
CRUDingly awful
Maybe
- fearware
- too bloated
- too simple
- over default ing
-
Maybe
- fearware
- too bloated
- too simple
- over default ing
- troll your own framework
justrails.rb
➔ Controllers ➔ Routing
➔ Views
➔ Models
1_application
2_Controllers
- Conventions
- URL Matching
- Autoloading
Conventions
1. <host>/products/index
2. ProductsController#index
3. products_controller
4. <app>/application/controllers
Autoloading
- const_get
- const_missing
- $LOAD_PATH
3_View
Interface to several Ruby template engines
3_View
Interface to several Ruby template engines
4_Methods as Rack Applications
5_Routing
Options?
➔ Middlewares ➔ Action* , Active*
➔ Inheritance
References
- edgeguides.rubyonrails.org/rails_on_rack.html
- rebuilding-rails.com
- Sinatra, Rails, Thin
Thank You!
Recommended