SQLite
The development default, in a file at .a2/dev.db.
import { createServer } from 'experimental-a2/server'
import { sqlite } from 'experimental-a2/store-sqlite'
import { orders } from '@/contracts'
export const ordersServer = createServer({
contract: orders,
store: sqlite({ path: '.a2/orders.db' }),
consumers: [
/* ... */
],
})In development, a server without a store uses SQLite at .a2/dev.db, so
your sessions survive next dev restarts. Pass it yourself to pick another
file.
It runs on node:sqlite, with no dependencies, and creates its tables when it
opens the file. A file a release before 0.21 wrote throws
STORE_NOT_CONFIGURED when it opens: delete it, or pass another path. It's
for development: a serverless filesystem doesn't last or
share one file across instances, so production needs another
store.
Options
| Option | |
|---|---|
path | the database file. Default .a2/dev.db; :memory: works |
clock, ids | test seams for timestamps and generated event ids |