Method: Nephos::Router#execute
- Defined in:
- lib/nephos-server/router/main.rb
#execute(req) ⇒ Object
Interface which handle the client query (stored in env), create a new Controller instance, and call the render on it
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/nephos-server/router/main.rb', line 71 def execute(req) #env = req.env puts "#{req.env["REMOTE_ADDR"]} [#{req.request_method}] \t ---> \t #{req.path}" unless @silent call = find_route(req) # require 'pry' # binding.pry return error_404(req) if call.nil? begin return render_controller(req, call) rescue => err STDERR.puts "Error: #{err.message}" unless @silent STDERR.puts err.backtrace unless @silent return error_custom(req, 500, "#{err.message}\n---Backtrace---\n#{err.backtrace.join("\n")}\n") end end |