rxfy-server-memory
v3.1.1
Published
In-memory storage adapter for rxfy-server
Readme
rxfy-server-memory
In-memory storage adapter for rxfy-server. Zero dependencies — each collection's Map is both the write target and the read source, so a demo or test app needs no database.
Install
npm install rxfy-server-memory
# peer deps: rxfy rxfy-serverWhat it gives you
defineCollection({ name, model, seed? })— an in-memory collection: aResourcewhose binding is its dataMap, plus.all()/.get(id)reads for serving.memoryStorage()— aSyncStorageover those collections. Pass it tocreateSync.MemoryBinding— the resource binding type ({ rows, getKey }).
import { createInMemoryHub, createSync } from "rxfy-server";
import { defineCollection, memoryStorage } from "rxfy-server-memory";
const posts = defineCollection({ name: "post", model: postModel, seed: [] });
const live = createSync({ storage: memoryStorage(), hub: createInMemoryHub(), secret });
await live.create(posts, { id, title }); // stores the row and publishes a patchSee the rxfy-server docs for the full walkthrough, and Storage adapters for how this adapter plugs in.
