Sha256: 3834cd76bc135750d01d1200560784c7def789419d9bd6f393a0ac35475b0c5c
Contents?: true
Size: 437 Bytes
Versions: 1
Compression:
Stored size: 437 Bytes
Contents
require 'rack' require 'json' class JsonHandler def call(env) [200, {"Content-Type" => "application/json"}, JSON.dump([{'Hello' => 'World!'}])] end end if __FILE__ == $0 require 'rack/handler/mongrel' server = Mongrel::HttpServer.new('0.0.0.0', 3000) server.register('/', Rack::Handler::Mongrel.new(Rack::File.new('.'))) server.register('/json', Rack::Handler::Mongrel.new(JsonHandler.new)) server.run.join end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rubyjs-0.8.0 | examples/client_server/server.rb |