All things Common Lisp

Serve static site with clack in few lines

Tagged as clack, lack, website, static, tips
Written on

While working on this blog I've stumbled on a basic need to serve static website from local folder. Though Coleslaw has magical command coleslaw preview it's good to know how to do it outside of Coleslaw.

There are numerous solutions in any language but we're talking CL here. And it's surprisingly simple:

  1. Install clack with ros install clack
  2. Create app.lisp in the target folder with the following content: (lack.app.file:make-app)
  3. Run clackup -s lack-middleware-static app.lisp and enjoy.
To load "lack-middleware-static":
  Load 1 ASDF system:
    lack-middleware-static
; Loading "lack-middleware-static"

Hunchentoot server is going to start.
Listening on 127.0.0.1:5000.