NRuby
20 строк · 322.0 Байт
1require 'rack'
2
3class App
4def self.call(env)
5headers = { 'Content-Type' => 'text/plain' }
6code = 200
7body = 'Hello, world!'
8
9unless env['PATH_INFO'] == '/'
10code = 404
11body = 'Not Found'
12end
13
14headers['Content-Length'] = body.length.to_s
15
16[code, headers, [body]]
17end
18end
19
20run App
21