lib/rapid_runty/application.rb in rapid_runty-0.1.2 vs lib/rapid_runty/application.rb in rapid_runty-0.1.3
- old
+ new
@@ -1,7 +1,7 @@
-require 'rapid_runty/routing'
-require 'rapid_runty/controller'
+require 'rapid_runty/router/base_route'
+require 'rapid_runty/controller/base_controller'
module RapidRunty
##
# Main framework Application class. Entry point for all requests.
#
@@ -16,23 +16,15 @@
# Retrieves the controller and action from request URL making a new
# controller and send it to the action.
#
# @param env [Hash] Rack environment Hash that includes CGI-like headers
#
- # @return [status, {headers}, [response]] array
+ # @return [status, {headers}, [response]]
def call(env)
request = Rack::Request.new(env)
+ response = Rack::Response.new
- verb = request.request_method.downcase.to_sym
- path = Rack::Utils.unescape(request.path_info)
-
- return [500, {}, []] if path == '/favicon.ico'
-
- route = routes.match(verb, path)
- if route.nil?
- [404, { 'Content-Type' => 'text/html' }, '404 not found']
- else
- [200, { 'Content-Type' => 'text/html' }, ["Hello RapidRunty"]]
- end
+ handle(env, request, response)
+ response.finish
end
end
end