Skip to content

Latest commit

 

History

History
182 lines (111 loc) · 5.33 KB

API.md

File metadata and controls

182 lines (111 loc) · 5.33 KB

Table of contents

  • rpub.core - The core API for using rPub as a library.
  • rpub.main - The main entry point for using rPub as an application.
    • current-system - An atom containing the current rPub server and REPL processes.
    • repl-defaults - The default options for the REPL.
    • start! - Start the rPub server and an optional REPL.
    • stop! - Stop the rPub server but not the REPL.
  • rpub.tasks - Tasks for rPub projects (compatible with Babashka).
    • supervisor - Starts a supervisor that auto-restarts an rPub server.

The core API for using rPub as a library.

The default options for the rPub server.

(get-content-items model opts)

Get a sequence of content items.

(get-content-types model opts)

Get a sequence of content types.

(get-settings model opts)

Get a sequence of settings.

(get-users model opts)

Get a sequence of users.

A multimethod that returns the plugin definition for key k.

Each method should return a map with the following keys:

:label - (required) a label :description - (required) a description :init - (optional) an initialization function :middleware - (optional) a sequence of middleware functions :routes - (optional) a sequence of route definitions

(start! & {:as opts})

Start the rPub server.

(stop! system)

Stop the rPub server.

(url-for content-item req)

Get a URL for a content item.


The main entry point for using rPub as an application.

An atom containing the current rPub server and REPL processes.

The default options for the REPL.

(start! & {:as opts})

Start the rPub server and an optional REPL.

The REPL is enabled by default (see rpub.main/repl-defaults).

(stop!)

Stop the rPub server but not the REPL.


Tasks for rPub projects (compatible with Babashka).

(supervisor & {:as opts})

Starts a supervisor that auto-restarts an rPub server.

The supervisor starts a child rPub server using the clojure CLI command and restarts it automatically if it stops with exit code 0. This allows rPub to load new Clojure dependencies after modifying the deps.edn file through the admin UI.

This function is meant to be run using Babashka to minimize memory overhead.