anchor.diff:                                     :content-type "text/javascript")
     *js-templates*)
   
  -(restas:define-route all-messages ("/")
  -  (messages:show-all-messages (list :messages
  -                                    (loop for msg in *messages*
  -                                       collect (list* :href (message-url msg) msg)))))
  +(restas:define-route all-messages ("/"
  +                                   :render-method 'messages:show-all-messages)
  +  (list :messages
  +        (loop for msg in *messages*
  +           collect (message-with-href msg))))
   
   (restas:define-route create-message ("/"
                                        :method :post
  -                                     :content-type "text/javascript")
  -  (message-json (car (push (list :id (incf *last-message-id*)
  -                                 :author (hunchentoot:post-parameter "author")
  -                                 :title (hunchentoot:post-parameter "title")
  -                                 :message (hunchentoot:post-parameter "message"))
  -                           *messages*))))
  +                                     :content-type "text/javascript"
  +                                     :render-method #'json:encode-json-plist-to-string)
  +  (message-with-href (make-message (hunchentoot:post-parameter "author")
  +                                   (hunchentoot:post-parameter "title")
  +                                   (hunchentoot:post-parameter "message"))))
   
   
   (restas:define-route message-detail ("messages/:id"
  -                                     :content-type "text/javascript")
  -  (let ((msg (find (parse-integer id)
  -                   *messages*
  -                   :key #'message-id)))
  -    (if msg
  -        (message-json msg)
  -        hunchentoot:+http-not-found+)))
  +                                     :content-type "text/javascript"
  +                                     :render-method #'json:encode-json-plist-to-string )
  +  (or (find (parse-integer id)
  +            *messages*
  +            :key #'message-id)
  +      hunchentoot:+http-not-found+))
  
positive.code: ;;;;
  ;;;; Author: Moskvitin Andrey <archimag@gmail.com>
  
  
  (require 'asdf)
  
  (loop for system in '(#:closure-template ;; http://code.google.com/p/cl-closure-template/
                        #:parenscript      ;; http://common-lisp.net/project/parenscript/
                        #:restas           ;; http://www.cliki.net/RESTAS
                        )
     do (asdf:operate 'asdf:load-op system))
  
  (restas:defsite #:example.messages
    (:use :cl))
  
  (restas:start-site '#:example.messages :port 8080)
  
  
  (in-package #:example.messages)
  
  
negative.code: 
  (defvar *messages* nil)
  
  (defun message-id (msg)
    (getf msg :id))
  
  (defun message-with-href (msg)
    (list* :href (restas:genurl 'message-detail :id (message-id msg))
           msg))
  
  (defun make-message (author title message)
    (car (push (list :id (incf *last-message-id*)
                     :author author
                     :title title
                     :message message)
               *messages*)))
  
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  ;;;; routes
  