On 01 Jul 2011, at 12:31, Nick Ager wrote:
or even:
hello world: ((ZnServer defaultOn: 1337) delegate: (ZnDispatcherDelegate new map: '/' to: [ :request :response | response entity: (ZnEntity text: 'Hello World!') ])) start
echo: ((ZnServer defaultOn: 1337) delegate: (ZnDispatcherDelegate new map: '/' to: [ :request :response | response entity: (ZnEntity with: request contents) ])) start
Yes, of course Nick, but then you better use the prefixes: ((ZnServer defaultOn: 1337) delegate: (ZnDispatcherDelegate new map: '/hello' to: [ :request :response | response entity: (ZnEntity text: 'Hello World!') ])) start ((ZnServer defaultOn: 1337) delegate: (ZnDispatcherDelegate new map: '/echo' to: [ :request :response | response entity: (ZnEntity with: request contents) ])) start Writing the shortest possible server code is a dubioius challenge. Although few Smalltalker would be happy to use verbose and heavy Java and XML. It is important that simple things be easy, short and elegant and complex things be possible. Sven