Examples

Each example is short and focused on one pattern for building applications with Holster.

Running the examples

Every example can be run in Node's REPL, the interactive prompt you get by typing node on its own. In an empty folder, install Holster and start the REPL:

npm install @mblaney/holster
node

Then paste these lines at the prompt:

const {default: Holster} = await import("@mblaney/holster/src/holster.js")
const holster = Holster({port: 8765})

The REPL can't use import statements, so the first line uses import() instead, and await works at the prompt without a function around it. Passing a port makes this instance a relay, which stores data in a radata folder, so the examples work without connecting to anything else.

You can paste each block of an example in one go, since the REPL waits for each await to finish before running the next line. A few things to know:

The examples