Rack stellt eine minimale, modulare und adaptive Schnittstelle für die Entwicklung von Webapplikationen in der Programmiersprache Ruby bereit. Durch das Wrappen von HTTP-Requests und HTTP-Responses, das auf möglichst einfache Weise erfolgt, vereinheitlicht es die Schnittstelle für Webserver, Webframeworks und die Software dazwischen, die Middleware, und destilliert diese Zugriffe zu einem einzigen Methodenaufruf.
Rack wird in fast allen Webframeworks und Weblibraries in der Ruby-Welt benutzt, z. B. von Ruby On Rails und Sinatra. Es ist als Ruby Gem verfügbar.https://rubygems.org/gems/rack/
Rack stellt in der Ruby-Welt einen De-facto-Standard der Rack-Kompatibilität () darrubyinside.com und hat bereits ein Framework in der JavaScript-Welt (jackjs) und eines in der Perl-Welt (Plack) inspiriert.
Beispielapplikation Eine Rack-kompatible "Hello World"-Applikation in Ruby syntax: require 'rack'
app = Proc.new do |env| body = "Hello, World!" ['200', {'Content-Type' => 'text/html', 'Content-Length' => body.length.to_s}, [body]] end
Rack::Handler::WEBrick.run app
Siehe auch Web Server Gateway Interface (Python) Perl Web Server Gateway Interface Python Paste FastCGI Servlet (Java) Server-side JavaScript Apache JServ Protocol Internet Communications Engine Etch (Protokoll) (Cisco) Internet Server API (Microsoft) Ring (Clojure)
Weblinks Rack Project Rack Schnittstellenspezifikation Rack wiki github Rack at Google Groups Rack-compliant applications Thin Ruby web server The introductory blog post Rack Yehuda Katz Rack coding contest jackjs, a JavaScript clone of Rack
Einzelnachweise
Kategorie:Ruby (Programmiersprache) Kategorie:Web-Entwicklung Kategorie:Freie Server-Software