Sha256: b5da615a0f415a10081f4b2af116713230e66e92c2150b283899049f03962305
Contents?: true
Size: 562 Bytes
Versions: 2
Compression:
Stored size: 562 Bytes
Contents
#!/usr/bin/env ruby require 'json' require 'time' require 'udp_rest' req_count = 0 port = (ARGV.last || 7890).to_i puts "listening on 0.0.0.0:#{port}..." UDPRest::Server.new(:port => port) do |s| s.get '/' do "Hello, World!\nVisit http://github.com/reednj/udp_rest for more info" end s.get '/hello' do 'hello' end s.post '/time' do Time.now.to_s end s.get '/time/unix' do Time.now.to_i end s.get '/time/iso' do Time.now.iso8601 end s.get '/count' do req_count += 1 req_count.to_s end s.get '/too_long' do 'a' * 600 end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
udp_rest-0.9.2 | demo/simple_server.rb |
udp_rest-0.9.0 | demo/simple_server.rb |