Simple Rest Server S. Ducasse http://www.pharo.org
Jul 18, 2015
| books teapot | books := Dictionary new. teapot := Teapot configure: { #defaultOutput -> #json. #port -> 8080. #debugMode -> true }.
teapot GET: '/books' -> books; ! PUT: '/books/<id>' -> [ :request | | book | book := {'author' -> (request at: #author). 'title' -> (request at: #title)} asDictionary. books at: (request at: #id) put: book ]; ! DELETE: '/books/<id>' -> [:request | books removeKey: (request at: #id)]; ! exception: KeyNotFound -> (TeaResponse notFound body: 'No such book'); ! start.