Lucerne ยป API Reference

Apps

base-app
The base class for all Lucerne applications.
  • routes
    The application's routes.
  • middlewares
    List of middlewares the application will run.
  • sub-apps
    A list of sub-application mount points.
  • handler
    The server handler.
defapp(name &key middlewares sub-apps (class (quote (quote base-app))))
Define an application.

Views

defview(name (&rest args) &rest body)
Define a view. The body of the view implicitly has access to the global request object *request*.
*request*
The current request. This will be bound in the body of a view through a lexical let.
respond(body &key (type text/html;charset=utf-8) (status 200))
Construct a response from a body, content type and status code.
redirect(url &key (status 302))
Redirect a user to url, optionally specifying a status code status(302 by default).
sessionnil
Extract the session hash table from the request object.
with-params(params &body body)
Extract the parameters in param from the *request*, and bind them for use in body.
render-template((template) &rest args)
Render a Djula template template-name passing arguments args.

Control

start((app base-app) &key (port 8000) (server hunchentoot) debug)
Bring up app, by default on port 8000. If the server was not running, it returns T. If the server was running, it restarts it and returns NIL.
stop((app base-app))
If app is running, stop it and return T. Otherwise, do nothing and return NIL.