Sha256: 95c85b6e2a698ff10ef394cc6ec01c3ccb8666ca0bd05754ef3d6c77e63b36b6

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

# REST over UDP

REST is a useful pattern for client-server interaction, but for simple scenarios setting up an entire HTTP stack is overkill. This gem provides a classes to allow for REST over UDP using a http-like protocol, as well as a curl like app for making requests from the command line.

The request and response size is limited 512 bytes, so this model is only appropriate for certain apis. 

## Try it out

There is a udp rest server running on uhttp.reednj.com, port 7890.

	gem install udp_rest
	udp-rest uhttp.reednj.com:7890

![terminal](docs/term.png)

Some other urls to try are:

 - uhttp.reednj.com:7890/time/iso
 - uhttp.reednj.com:7890/time/unix
 - uhttp.reednj.com:7890/count

## Client

Use the `UDPRest::Client` class to make requests programmatically

	UDPRest::Client.get('uhttp://uhttp.reednj.com:7890')
	UDPRest::Client.post('uhttp://uhttp.reednj.com:7890')

## Server

Use the `UDPRest::Server` class to create simple sinatra-style servers

	UDPRest::Server.new(:port => 7890) do |s|
		s.get '/'
			'hello, world!'
		end

		s.get '/time'
			Time.now.to_s
		end
	end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
udp_rest-0.9.2 readme.md