Clack

Revenge of Lisp in Web

Chapter 2: Getting Clack

English | 日本語

The easiest way to install Clack is to take advantage of Quicklisp. Run the following code on your Lisp.

(ql:quickload :clack)

Then all libraries including dependencies will be downloaded and be installed automatically.

To verify that you have everything installed correctly, let's start a Clack server. You don't have to understand the following code now. It will be mentioned the next chapter.

(clack:clackup
  (lambda (env)
    (declare (ignore env))
    '(200 (:content-type "text/plain") ("Hello, Clack!"))))

;-> Hunchentoot server is started.
    Listening on localhost:5000.
    # #x30200A102B3D>

Clack runs on localhost port 5000 by default. Open the URL http://127.0.0.1:5000/ on your browser and Clack show you "Hello, Clack!".

To stop the process, get back to REPL and execute the following code.

(clack:stop *)