storage-key-value
v1.0.6
Published
Server -> Client -> Server key value storage
Downloads
3
Maintainers
Readme
Usage:
Server:
var Storage = require('storage-key-value');
var app = express();
Storage.init({
file: path.dirname(process.mainModule.filename) + '/storage.json',
path: '/storage',
pretty: false
});
app.use(Storage);
Client:
<script src="/storage.js" type="text/javascript"></script>
<script type="text/javascript">
var __storage = {
my: 'initial_data',
without: 'this we would make initial ajax request'
};
Storage.init({
path: '/storage',
localStorage: 'storage',
dataKey: '__storage'
});
Storage.get('my') // 'initial_data';
Storage.set('my_key', { my_value: 123456 });
Storage.get('my_key'); // { my_value: 123456 }
</script>