Sha256: 0dc13a750f770463b8ca307ceaa7f0dcdbba4aa8daffdf7e6f200a99c8e2cc7d
Contents?: true
Size: 702 Bytes
Versions: 2
Compression:
Stored size: 702 Bytes
Contents
require 'rubygems' require 'json' require 'rack' require 'ext_direct' require 'pp' ExtDirect::Api.expose_all("./exposed_classes") app = Rack::Builder.new do use Rack::ShowExceptions map '/' do run Rack::Directory.new('./html') end map '/api' do run Proc.new { |env| [200, {'Content-Type' => 'text/json'}, [ExtDirect::Api.to_json]] } end map '/router' do run Proc.new { |env| result = '' req = Rack::Request.new(env) if req.post? data = env["rack.input"].gets pp data result = ExtDirect::Router.route(data) end [200, {'Content-Type' => 'text/html'}, [result.to_json]] } end end run app
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ruby_ext_direct-0.0.2 | examples/rack/config.ru |
ruby_ext_direct-0.0.1 | examples/rack/config.ru |