File: config.ru

package info (click to toggle)
ruby-async-http 0.59.5-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 572 kB
  • sloc: ruby: 4,164; javascript: 40; makefile: 4
file content (28 lines) | stat: -rw-r--r-- 438 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

require 'rack'

class Echo
	def initialize(app)
		@app = app
	end
	
	def call(env)
		request = Rack::Request.new(env)
		
		if request.path_info == "/echo"
			if output = request.body
				return [200, {}, output.body]
			else
				return [200, {}, ["Hello World?"]]
			end
		else
			return @app.call(env)
		end
	end
end

use Echo

use Rack::Static, :urls => [''], :root => 'public', :index => 'index.html'

run lambda{|env| [404, {}, []]}