wardbell / a2-in-memory-web-api

An in-memory web api for demos and tests
MIT License
47 stars 11 forks source link

Save/restore in-mem store to browser local storage (optional) #4

Open wardbell opened 8 years ago

wardbell commented 8 years ago

Ability to serialize/deserialize locally would facilitate browser refresh scenarios, simulating offline, etc.

On start the in-mem server could check browser storage for a well-known (configurable) named store. Server will load from there upon startup, falling back to resetDb() if not found.

During the life of the session, in-mem server updates that local store as side-effect of save (CUD) calls.

A call to commands/resetdb would reset the local store to the db initial state..

Probably should have a separate commands/clear-local-storage for that purpose alone.