A client side service based on feathers-memory that persists to LocalStorage
JavaScript
Permalink
Failed to load latest commit information.
.github Adding .github folder and templates Oct 22, 2016
dist Updating dist Nov 11, 2016
example
src jshint —> semistandard (#23) Oct 22, 2016
test Update and remove Node < 4 (#30) Nov 5, 2016
.babelrc Initial commit with version that probably does not work Feb 23, 2016
.editorconfig Initial commit with version that probably does not work Feb 23, 2016
.gitignore Update to latest feathers-memory and remove dist Apr 5, 2016
.istanbul.yml Adding coverage to .npmignore, Slack notifications / supported node v… Oct 26, 2016
.npmignore
.travis.yml Update and remove Node < 4 (#30) Nov 5, 2016
CHANGELOG.md Updating changelog Nov 11, 2016
LICENSE Initial commit with version that probably does not work Feb 23, 2016
README.md Adding coverage to .npmignore, Slack notifications / supported node v… Oct 26, 2016
mocha.opts Adding coverage to .npmignore, Slack notifications / supported node v… Oct 26, 2016
package.json Converting compile and clean tasks to shx for better windows support Jan 8, 2017

README.md

feathers-localstorage

Build Status Code Climate Test Coverage Dependency Status Download Status Slack Status

A client side service based on feathers-memory that persists to LocalStorage or AsyncStorage

Installation

npm install feathers-localstorage --save

Documentation

Please refer to the Feathers database adapter documentation for more details or directly at:

Complete Example

Here is an example of a Feathers server with a messages localstorage service that supports pagination. It uses the node module localstorage-memory.

var feathers = require('feathers');
var bodyParser = require('body-parser');
var rest = require('feathers-rest');
var socketio = require('feathers-socketio');
var localstorage = require('feathers-localstorage');
var storage = require('localstorage-memory');

// Create a feathers instance.
const app = feathers()
  // Enable REST services
  .configure(rest())
  // Enable Socket.io services
  .configure(socketio())
  // Turn on JSON parser for REST services
  .use(bodyParser.json())
  // Turn on URL-encoded parser for REST services
  .use(bodyParser.urlencoded({ extended: true }));

// Create an in-memory localstorage Feathers service with a default page size of 2 items and a maximum size of 4
app.use('/messages', localstorage({
  storage: storage,
  paginate: {
    default: 2,
    max: 4
  }
}));

// Create a dummy Message
app.service('messages').create({
  text: 'Server message',
  read: false
}).then(function(message) {
  console.log('Created message', message);
});

// Start the server.
var port = 3030;

app.listen(port, function() {
  console.log(`Feathers server listening on port ${port}`);
});

You can run this example with npm start from the cloned repository and going to localhost:3030/messages. You will see the test Message that we created at the end of that file.

License

Copyright (c) 2016

Licensed under the MIT license.