SlideShare uma empresa Scribd logo
1 de 28
by Raphael Monteiro - 04/2015
Things that nobody(or almost nobody) talk
about.
Keep the secret or DIE!!(just kidding S2)
● Rails on Rack (What the RACK is going on?!)
● ‘Action Dispatch: Where it all begins’
‘Rack aims to provide a minimal API for
connecting web server and web frameworks’
Rack provides a minimal, modular and adaptable interface for
developing web applications in Ruby. By wrapping HTTP requests
and responses in the simplest way possible, it unifies and
distills the API for web servers, web frameworks, and software
in between (the so-called middleware) into a single method call.
● Example: rails server
RACK
(process
and build)
Web Server
and
App Server
(Webrick)
Browser
(Client side)
Web
Framework
● The most simple Rack application
● Rails 2.3, request handling was moved to
Rack and the concept of middleware was
introduced.
● Classes that satisfy Rack's call interface can
be chained together as filters. (Rack
Middleware)
● Much of Action Controller is implemented
as Rack middleware modules.
$ rake middleware
● You can create your own middleware
● config/application.rb ou environment/*.rb
● config.middleware.use(new_middleware, args)
● config.middleware.insert_before(existing_middl
eware, new_middleware, args)
● Don't forget to initizalize and call app.call(env)
● Rack is a framework to roll your own ruby framework.
● Rack provides an interface between different web servers and your framework/application.
Making it very simple for your framework/application to be compatible with any webserver
that supports Rack – Phusion Passenger, Litespeed, Mongrel, Thin, Ebb, Webrick to name a
few.
● Rack cuts your chase. You get request, response, cookies, params & sessions for free.
● Makes it possible to use multiple frameworks for the same application, provided there is no
class collision. Rails and sinatra integration is a good example of this.
● Middlewares ! Think of middlewares as Rails’s before_filter/after_filter that are reusable across
different rack supported frameworks/applications. For example, you can use the same Anti-
spamming rack middleware for your Rails app, Sinatra app and your custom Rack application
too!
● The entry point to a request is an instance of
ActionDispatch::Routing::RouteSet
● Example:
route: get 'foo', to: 'foo#index'
instance: FooController.action(:index).call
endpoint is our application's routes, an instance of ActionDispatch::Routing::RouteSet
● Operational::Application.routes
and then invoke the #call method...
@router is an instance of Journey::Router
● Journey is the core routing module in
ActionDispatch.
● It is constructed by the code you define in
config/routes.rb
● When constructing the routing table, the
ActionDispatch::Routing::Mapper class calls
add_route, which will construct a
Journey::Route instance associated with a
controller endpoint (the Rack app) and add it
to the routing table.
● @set is the RouteSet
● app referenced here is an instance of
ActionDispatch::Routing::Dispatcher
Finally…
FooController.action(:index).call
● Rack Creator:
http://chneukirchen.org/blog/archive/2007/02/introducing-rack.html
● Inside Rack and ActionDispatcher: http://pothibo.com/2013/11/ruby-on-
rails-inside-actiondispatch-and-rack/
● Understaing Rails from request to response in 3 parts(part I):
http://andrewberls.com/blog/post/rails-from-request-to-response-part-
1--introduction
● How to create a Ruby web server:
https://github.com/macournoyer/tube
● The Rails 4 Way, O. Fernandez, K. Faustino, June 2014

Mais conteúdo relacionado

Mais procurados

SignalR for ASP.NET Developers
SignalR for ASP.NET DevelopersSignalR for ASP.NET Developers
SignalR for ASP.NET DevelopersShivanand Arur
 
Introduction to SignalR
Introduction to SignalRIntroduction to SignalR
Introduction to SignalRAdam Mokan
 
Introduction To Ruby On Rails
Introduction To Ruby On RailsIntroduction To Ruby On Rails
Introduction To Ruby On RailsSteve Keener
 
SignalR With ASP.Net part1
SignalR With ASP.Net part1SignalR With ASP.Net part1
SignalR With ASP.Net part1Esraa Ammar
 
Serverless architecture
Serverless architectureServerless architecture
Serverless architecturevipin kumar
 
Angular Owin Katana TypeScript
Angular Owin Katana TypeScriptAngular Owin Katana TypeScript
Angular Owin Katana TypeScriptJustin Wendlandt
 
Building Realtime Web Applications With ASP.NET SignalR
Building Realtime Web Applications With ASP.NET SignalRBuilding Realtime Web Applications With ASP.NET SignalR
Building Realtime Web Applications With ASP.NET SignalRShravan Kumar Kasagoni
 
Intro to SPA using JavaScript & ASP.NET
Intro to SPA using JavaScript & ASP.NETIntro to SPA using JavaScript & ASP.NET
Intro to SPA using JavaScript & ASP.NETAlan Hecht
 
Scale your signalR realtime web application
Scale your signalR realtime web applicationScale your signalR realtime web application
Scale your signalR realtime web applicationRan Wahle
 
Wire once, rewire twice! (Haskell exchange-2018)
Wire once, rewire twice! (Haskell exchange-2018)Wire once, rewire twice! (Haskell exchange-2018)
Wire once, rewire twice! (Haskell exchange-2018)Eric Torreborre
 
Mule soft meetup__official__feb-27_2021
Mule soft meetup__official__feb-27_2021Mule soft meetup__official__feb-27_2021
Mule soft meetup__official__feb-27_2021sumitahuja94
 

Mais procurados (20)

Real time web with SignalR
Real time web with SignalRReal time web with SignalR
Real time web with SignalR
 
SignalR
SignalRSignalR
SignalR
 
Rails Concept
Rails ConceptRails Concept
Rails Concept
 
SignalR
SignalRSignalR
SignalR
 
SignalR for ASP.NET Developers
SignalR for ASP.NET DevelopersSignalR for ASP.NET Developers
SignalR for ASP.NET Developers
 
Introduction to SignalR
Introduction to SignalRIntroduction to SignalR
Introduction to SignalR
 
Introduction To Ruby On Rails
Introduction To Ruby On RailsIntroduction To Ruby On Rails
Introduction To Ruby On Rails
 
Intro to signalR
Intro to signalRIntro to signalR
Intro to signalR
 
Introduction to SignalR
Introduction to SignalRIntroduction to SignalR
Introduction to SignalR
 
SignalR With ASP.Net part1
SignalR With ASP.Net part1SignalR With ASP.Net part1
SignalR With ASP.Net part1
 
Serverless architecture
Serverless architectureServerless architecture
Serverless architecture
 
Angular Owin Katana TypeScript
Angular Owin Katana TypeScriptAngular Owin Katana TypeScript
Angular Owin Katana TypeScript
 
Real-time ASP.NET with SignalR
Real-time ASP.NET with SignalRReal-time ASP.NET with SignalR
Real-time ASP.NET with SignalR
 
Building Realtime Web Applications With ASP.NET SignalR
Building Realtime Web Applications With ASP.NET SignalRBuilding Realtime Web Applications With ASP.NET SignalR
Building Realtime Web Applications With ASP.NET SignalR
 
Intro to SPA using JavaScript & ASP.NET
Intro to SPA using JavaScript & ASP.NETIntro to SPA using JavaScript & ASP.NET
Intro to SPA using JavaScript & ASP.NET
 
SignalR Overview
SignalR OverviewSignalR Overview
SignalR Overview
 
Scale your signalR realtime web application
Scale your signalR realtime web applicationScale your signalR realtime web application
Scale your signalR realtime web application
 
Wire once, rewire twice! (Haskell exchange-2018)
Wire once, rewire twice! (Haskell exchange-2018)Wire once, rewire twice! (Haskell exchange-2018)
Wire once, rewire twice! (Haskell exchange-2018)
 
Mule soft meetup__official__feb-27_2021
Mule soft meetup__official__feb-27_2021Mule soft meetup__official__feb-27_2021
Mule soft meetup__official__feb-27_2021
 
Angular
AngularAngular
Angular
 

Destaque

Jurassic JavaScript Park - Rodando Offline até na ilha Nublar!
Jurassic JavaScript Park - Rodando Offline até na ilha Nublar!Jurassic JavaScript Park - Rodando Offline até na ilha Nublar!
Jurassic JavaScript Park - Rodando Offline até na ilha Nublar!Creditas
 
A arte de ser Mensch
A arte de ser MenschA arte de ser Mensch
A arte de ser MenschCreditas
 
How To Get Organized
How To Get OrganizedHow To Get Organized
How To Get OrganizedCreditas
 
Debugging with pry
Debugging with pryDebugging with pry
Debugging with pryCreditas
 
Positive reinforcement and statistics
Positive reinforcement and statisticsPositive reinforcement and statistics
Positive reinforcement and statisticsCreditas
 
O que o seu texto diz sobre você
O que o seu texto diz sobre vocêO que o seu texto diz sobre você
O que o seu texto diz sobre vocêCreditas
 
O paradoxo da escolha
O paradoxo da escolhaO paradoxo da escolha
O paradoxo da escolhaCreditas
 
Modern sql
Modern sqlModern sql
Modern sqlCreditas
 
Text mining Pre-processing
Text mining Pre-processingText mining Pre-processing
Text mining Pre-processingCreditas
 
OOCSS and SMACSS
OOCSS and SMACSSOOCSS and SMACSS
OOCSS and SMACSSCreditas
 
An introduction to MySQL
An introduction to MySQLAn introduction to MySQL
An introduction to MySQLCreditas
 
Como melhorar sua comunicação com sua equipe, sua mãe e seu chefe
Como melhorar sua comunicação com sua equipe, sua mãe e seu chefeComo melhorar sua comunicação com sua equipe, sua mãe e seu chefe
Como melhorar sua comunicação com sua equipe, sua mãe e seu chefeCreditas
 
Pig - Analyzing data sets
Pig - Analyzing data setsPig - Analyzing data sets
Pig - Analyzing data setsCreditas
 
Melanoma: how to detect skin cancer
Melanoma: how to detect skin cancerMelanoma: how to detect skin cancer
Melanoma: how to detect skin cancerCreditas
 

Destaque (15)

Jurassic JavaScript Park - Rodando Offline até na ilha Nublar!
Jurassic JavaScript Park - Rodando Offline até na ilha Nublar!Jurassic JavaScript Park - Rodando Offline até na ilha Nublar!
Jurassic JavaScript Park - Rodando Offline até na ilha Nublar!
 
A arte de ser Mensch
A arte de ser MenschA arte de ser Mensch
A arte de ser Mensch
 
How To Get Organized
How To Get OrganizedHow To Get Organized
How To Get Organized
 
Debugging with pry
Debugging with pryDebugging with pry
Debugging with pry
 
Positive reinforcement and statistics
Positive reinforcement and statisticsPositive reinforcement and statistics
Positive reinforcement and statistics
 
O que o seu texto diz sobre você
O que o seu texto diz sobre vocêO que o seu texto diz sobre você
O que o seu texto diz sobre você
 
O paradoxo da escolha
O paradoxo da escolhaO paradoxo da escolha
O paradoxo da escolha
 
Modern sql
Modern sqlModern sql
Modern sql
 
Sublime
SublimeSublime
Sublime
 
Text mining Pre-processing
Text mining Pre-processingText mining Pre-processing
Text mining Pre-processing
 
OOCSS and SMACSS
OOCSS and SMACSSOOCSS and SMACSS
OOCSS and SMACSS
 
An introduction to MySQL
An introduction to MySQLAn introduction to MySQL
An introduction to MySQL
 
Como melhorar sua comunicação com sua equipe, sua mãe e seu chefe
Como melhorar sua comunicação com sua equipe, sua mãe e seu chefeComo melhorar sua comunicação com sua equipe, sua mãe e seu chefe
Como melhorar sua comunicação com sua equipe, sua mãe e seu chefe
 
Pig - Analyzing data sets
Pig - Analyzing data setsPig - Analyzing data sets
Pig - Analyzing data sets
 
Melanoma: how to detect skin cancer
Melanoma: how to detect skin cancerMelanoma: how to detect skin cancer
Melanoma: how to detect skin cancer
 

Semelhante a Rack Middleware and Rails Request Handling

Rails request & middlewares
Rails request & middlewaresRails request & middlewares
Rails request & middlewaresSantosh Wadghule
 
Ruby On Rails Siddhesh
Ruby On Rails SiddheshRuby On Rails Siddhesh
Ruby On Rails SiddheshSiddhesh Bhobe
 
Rails Request & Middlewares
Rails Request & MiddlewaresRails Request & Middlewares
Rails Request & MiddlewaresSantosh Wadghule
 
Ruby On Rails Seminar Basis Softexpo Feb2010
Ruby On Rails Seminar Basis Softexpo Feb2010Ruby On Rails Seminar Basis Softexpo Feb2010
Ruby On Rails Seminar Basis Softexpo Feb2010arif44
 
.NET Architects Day - DNAD 2011
.NET Architects Day - DNAD 2011.NET Architects Day - DNAD 2011
.NET Architects Day - DNAD 2011Fabio Akita
 
09 - Fábio Akita - Além do rails
09 - Fábio Akita - Além do rails09 - Fábio Akita - Além do rails
09 - Fábio Akita - Além do railsDNAD
 
Ruby On Rails
Ruby On RailsRuby On Rails
Ruby On Railsanides
 
Viridians on Rails
Viridians on RailsViridians on Rails
Viridians on RailsViridians
 
Onion Architecture with S#arp
Onion Architecture with S#arpOnion Architecture with S#arp
Onion Architecture with S#arpGary Pedretti
 
Guide to Using React Router V6 in React Apps.pdf
Guide to Using React Router V6 in React Apps.pdfGuide to Using React Router V6 in React Apps.pdf
Guide to Using React Router V6 in React Apps.pdfAdarshMathuri
 
Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber
       Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber       Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber
Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & CucumberUdaya Kiran
 
Ruby on Rails Penetration Testing
Ruby on Rails Penetration TestingRuby on Rails Penetration Testing
Ruby on Rails Penetration Testing3S Labs
 
Ruby On Rails Basics
Ruby On Rails BasicsRuby On Rails Basics
Ruby On Rails BasicsAmit Solanki
 
Laravel - A Trending PHP Framework
Laravel - A Trending PHP FrameworkLaravel - A Trending PHP Framework
Laravel - A Trending PHP Frameworkijtsrd
 
ROS Based Programming and Visualization of Quadrotor Helicopters
ROS Based Programming and Visualization of Quadrotor HelicoptersROS Based Programming and Visualization of Quadrotor Helicopters
ROS Based Programming and Visualization of Quadrotor HelicoptersAtılay Mayadağ
 

Semelhante a Rack Middleware and Rails Request Handling (20)

Rails request & middlewares
Rails request & middlewaresRails request & middlewares
Rails request & middlewares
 
Ruby On Rails Siddhesh
Ruby On Rails SiddheshRuby On Rails Siddhesh
Ruby On Rails Siddhesh
 
Rails Request & Middlewares
Rails Request & MiddlewaresRails Request & Middlewares
Rails Request & Middlewares
 
Intro to Rack
Intro to RackIntro to Rack
Intro to Rack
 
Ruby On Rails Seminar Basis Softexpo Feb2010
Ruby On Rails Seminar Basis Softexpo Feb2010Ruby On Rails Seminar Basis Softexpo Feb2010
Ruby On Rails Seminar Basis Softexpo Feb2010
 
.NET Architects Day - DNAD 2011
.NET Architects Day - DNAD 2011.NET Architects Day - DNAD 2011
.NET Architects Day - DNAD 2011
 
09 - Fábio Akita - Além do rails
09 - Fábio Akita - Além do rails09 - Fábio Akita - Além do rails
09 - Fábio Akita - Além do rails
 
Ruby On Rails
Ruby On RailsRuby On Rails
Ruby On Rails
 
Rack
RackRack
Rack
 
Aspose pdf
Aspose pdfAspose pdf
Aspose pdf
 
Viridians on Rails
Viridians on RailsViridians on Rails
Viridians on Rails
 
Onion Architecture with S#arp
Onion Architecture with S#arpOnion Architecture with S#arp
Onion Architecture with S#arp
 
Sinatra
SinatraSinatra
Sinatra
 
Guide to Using React Router V6 in React Apps.pdf
Guide to Using React Router V6 in React Apps.pdfGuide to Using React Router V6 in React Apps.pdf
Guide to Using React Router V6 in React Apps.pdf
 
Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber
       Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber       Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber
Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber
 
Node.js Course 2 of 2 - Advanced techniques
Node.js Course 2 of 2 - Advanced techniquesNode.js Course 2 of 2 - Advanced techniques
Node.js Course 2 of 2 - Advanced techniques
 
Ruby on Rails Penetration Testing
Ruby on Rails Penetration TestingRuby on Rails Penetration Testing
Ruby on Rails Penetration Testing
 
Ruby On Rails Basics
Ruby On Rails BasicsRuby On Rails Basics
Ruby On Rails Basics
 
Laravel - A Trending PHP Framework
Laravel - A Trending PHP FrameworkLaravel - A Trending PHP Framework
Laravel - A Trending PHP Framework
 
ROS Based Programming and Visualization of Quadrotor Helicopters
ROS Based Programming and Visualization of Quadrotor HelicoptersROS Based Programming and Visualization of Quadrotor Helicopters
ROS Based Programming and Visualization of Quadrotor Helicopters
 

Mais de Creditas

Hanami & Domain-Driven Design
Hanami & Domain-Driven DesignHanami & Domain-Driven Design
Hanami & Domain-Driven DesignCreditas
 
Application layer
Application layerApplication layer
Application layerCreditas
 
Hanami with a modern touch
Hanami with a modern touchHanami with a modern touch
Hanami with a modern touchCreditas
 
Rails Girls - RubyConfBR 2015
Rails Girls - RubyConfBR 2015Rails Girls - RubyConfBR 2015
Rails Girls - RubyConfBR 2015Creditas
 
GTD - Getting Things Done
GTD - Getting Things DoneGTD - Getting Things Done
GTD - Getting Things DoneCreditas
 
Learning how to learn
Learning how to learnLearning how to learn
Learning how to learnCreditas
 
Solid - OOD Principles
Solid - OOD PrinciplesSolid - OOD Principles
Solid - OOD PrinciplesCreditas
 
Sistemas de recomendação em ruby
Sistemas de recomendação em rubySistemas de recomendação em ruby
Sistemas de recomendação em rubyCreditas
 
Do MONOLÍTICO à arquitetura distribuída
Do MONOLÍTICO à arquitetura distribuídaDo MONOLÍTICO à arquitetura distribuída
Do MONOLÍTICO à arquitetura distribuídaCreditas
 
Deploy Heroku
Deploy HerokuDeploy Heroku
Deploy HerokuCreditas
 

Mais de Creditas (12)

Hanami & Domain-Driven Design
Hanami & Domain-Driven DesignHanami & Domain-Driven Design
Hanami & Domain-Driven Design
 
Application layer
Application layerApplication layer
Application layer
 
Hanami with a modern touch
Hanami with a modern touchHanami with a modern touch
Hanami with a modern touch
 
Rails Girls - RubyConfBR 2015
Rails Girls - RubyConfBR 2015Rails Girls - RubyConfBR 2015
Rails Girls - RubyConfBR 2015
 
GTD - Getting Things Done
GTD - Getting Things DoneGTD - Getting Things Done
GTD - Getting Things Done
 
Neo4 j
Neo4 jNeo4 j
Neo4 j
 
Learning how to learn
Learning how to learnLearning how to learn
Learning how to learn
 
Solid - OOD Principles
Solid - OOD PrinciplesSolid - OOD Principles
Solid - OOD Principles
 
Sistemas de recomendação em ruby
Sistemas de recomendação em rubySistemas de recomendação em ruby
Sistemas de recomendação em ruby
 
Do MONOLÍTICO à arquitetura distribuída
Do MONOLÍTICO à arquitetura distribuídaDo MONOLÍTICO à arquitetura distribuída
Do MONOLÍTICO à arquitetura distribuída
 
Minitest
MinitestMinitest
Minitest
 
Deploy Heroku
Deploy HerokuDeploy Heroku
Deploy Heroku
 

Último

TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 

Último (20)

TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 

Rack Middleware and Rails Request Handling

  • 2.
  • 3. Things that nobody(or almost nobody) talk about. Keep the secret or DIE!!(just kidding S2)
  • 4. ● Rails on Rack (What the RACK is going on?!) ● ‘Action Dispatch: Where it all begins’
  • 5. ‘Rack aims to provide a minimal API for connecting web server and web frameworks’ Rack provides a minimal, modular and adaptable interface for developing web applications in Ruby. By wrapping HTTP requests and responses in the simplest way possible, it unifies and distills the API for web servers, web frameworks, and software in between (the so-called middleware) into a single method call.
  • 6. ● Example: rails server RACK (process and build) Web Server and App Server (Webrick) Browser (Client side) Web Framework
  • 7. ● The most simple Rack application
  • 8. ● Rails 2.3, request handling was moved to Rack and the concept of middleware was introduced. ● Classes that satisfy Rack's call interface can be chained together as filters. (Rack Middleware)
  • 9. ● Much of Action Controller is implemented as Rack middleware modules. $ rake middleware
  • 10.
  • 11.
  • 12. ● You can create your own middleware ● config/application.rb ou environment/*.rb ● config.middleware.use(new_middleware, args) ● config.middleware.insert_before(existing_middl eware, new_middleware, args) ● Don't forget to initizalize and call app.call(env)
  • 13. ● Rack is a framework to roll your own ruby framework. ● Rack provides an interface between different web servers and your framework/application. Making it very simple for your framework/application to be compatible with any webserver that supports Rack – Phusion Passenger, Litespeed, Mongrel, Thin, Ebb, Webrick to name a few. ● Rack cuts your chase. You get request, response, cookies, params & sessions for free. ● Makes it possible to use multiple frameworks for the same application, provided there is no class collision. Rails and sinatra integration is a good example of this. ● Middlewares ! Think of middlewares as Rails’s before_filter/after_filter that are reusable across different rack supported frameworks/applications. For example, you can use the same Anti- spamming rack middleware for your Rails app, Sinatra app and your custom Rack application too!
  • 14. ● The entry point to a request is an instance of ActionDispatch::Routing::RouteSet ● Example: route: get 'foo', to: 'foo#index' instance: FooController.action(:index).call
  • 15.
  • 16.
  • 17.
  • 18. endpoint is our application's routes, an instance of ActionDispatch::Routing::RouteSet
  • 19. ● Operational::Application.routes and then invoke the #call method...
  • 20. @router is an instance of Journey::Router
  • 21. ● Journey is the core routing module in ActionDispatch. ● It is constructed by the code you define in config/routes.rb
  • 22.
  • 23. ● When constructing the routing table, the ActionDispatch::Routing::Mapper class calls add_route, which will construct a Journey::Route instance associated with a controller endpoint (the Rack app) and add it to the routing table.
  • 24.
  • 25. ● @set is the RouteSet ● app referenced here is an instance of ActionDispatch::Routing::Dispatcher
  • 26.
  • 28. ● Rack Creator: http://chneukirchen.org/blog/archive/2007/02/introducing-rack.html ● Inside Rack and ActionDispatcher: http://pothibo.com/2013/11/ruby-on- rails-inside-actiondispatch-and-rack/ ● Understaing Rails from request to response in 3 parts(part I): http://andrewberls.com/blog/post/rails-from-request-to-response-part- 1--introduction ● How to create a Ruby web server: https://github.com/macournoyer/tube ● The Rails 4 Way, O. Fernandez, K. Faustino, June 2014

Notas do Editor

  1. That app parameter during the initialization is actually the next middleware in the chain.