Server Modes
Ce contenu n’est pas encore disponible dans votre langue.
Server modes change how yRest behaves at runtime — from auto-reloading the database on file changes to rejecting all writes, simulating latency, or saving state snapshots. Modes can be combined freely.
Watch mode
Section titled “Watch mode”--watch / watch: true
Readonly mode
Section titled “Readonly mode”--readonly / readonly: true
Delay mode
Section titled “Delay mode”--delay <ms> / delay: 500
Snapshot mode
Section titled “Snapshot mode”--snapshot / snapshot: true
Snapshot mode saves the initial state of the database at startup and exposes three meta endpoints:
| Endpoint | Description |
|---|---|
GET /_snapshot | Snapshot metadata (saved timestamp) |
POST /_snapshot/save | Save current state as new snapshot |
POST /_snapshot/reset | Restore to last saved snapshot |
Pageable mode
Section titled “Pageable mode”--pageable [limit] / pageable: true
Id strategy
Section titled “Id strategy”--id-strategy increment|uuid / idStrategy: uuid
Combining modes
Section titled “Combining modes”Next steps
Section titled “Next steps”- Configuration — set modes permanently in
yrest.config.yml - CLI Reference — full flag syntax for
yrest serve - Programmatic API — pass modes as options to
createYrestServer()