Reblocks sites contains one or more apps. Where each app is responsible for serving requests starting from some prefix.
For example, your site can have a few apps mounted to
The simplest way to define a new app is to use
defapp macro like this:
(defapp blog :prefix "/blog/")
And then to define a method for
reblocks/session:init generic-function. It will be called if
user will open https://yoursite.com/blog/ in his browser.
name &rest initargs &key prefix subclasses slots
description documentation (autostart t) &allow-other-keys
This macro defines the key parameters for a stand alone web application.
It defines both a class with name 'name' and registers an instance of that class. It also instantiates a defvar with an instance of this class. This is intended to be the primary way a web application is defined.
URIfrom where this app should be available on the server. Read more about this in the
SUBCLASSES- if you want to inherit subclass behavior from other webapps, you can. It's not likely to be needed much
SLOTS- webapps are class so slots are a list of definitions just as in defclass, but as slots are likely to be rare on webapps, we make this a keyword argument.
All of the following, when present, are passed through as additional initargs:
NAME- instantiates a username (and the default title for) a webapp. use this name to get and delete this webapp. Multiple instances of a webapp class can co-exist, so long as they have different prefixes
DESCRIPTION- A description of the application for the title page
DOCUMENTATION- Content of this argument will be added as (:documentation ...) form to the class definition.
AUTOSTART- Whether this webapp is started automatically when start-reblocks is called (primarily for backward compatibility
A class that encapsulates a unique web application and all relevant rnesources. A webapp is a unique set of dependencies and information that can be enabled or disabled independently of others. Multiple webapps can be active concurrently and incoming connections are dispatched to the root of the webapp according to a prefix parameter that defines the
URLs parsed by that webapp. The webapp does not see the prefix parameter in
URLs that are provided to it. You can, for instance, have different sites (e.g. mobile vs. desktop) with vastly different layout and dependencies running on the same server.
The subtree of the
URIspace at this site that belongs to the webapp.
A protocol for performing any special initialization on the creation of a webapp object.
app &body forms
Bind variables that are both webapp-specific, or applicable to just this app, and webapp-general, or not particular to some request to this app, with regard to
By default, adds entries with Content-Type, description and keywords to the app's page.