0.3.0 • Published 4 years ago

simplyput v0.3.0

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

SimplyPut client

A lightweight javascript client for SimplyPut.

Roadmap

  • Basic authentication methods
  • Get/Put/Delete data
  • Error handling

Usage

Install the client into your project dependencies

yarn add simplyput

Initialise the client with your app ID

const SimplyPut = require('simplyput');

const simply = new SimplyPut('YOUR_APP_ID');

All data in SimplyPut is user-scoped, so first your user will need to register

await simply.register('email@example.com', 'password');

Once authenticated, they can put, get and delete any key-value data they want

await simply.put('foo', 'bar'); // 'bar' is now stored on key 'foo'

let value = await simply.get('foo');
console.log(value); // 'bar'

await simply.delete('foo');

When the user is done, don't forget to log them out again

await simply.logout();

Next time, they can log in again with the same credentials:

await simply.login('email@example.com', 'password');

Browser Compatibility

This client is designed to run in the browser. It uses several modern Javascript features:

The library should work in all evergreen browsers, but if you need to support older browsers (e.g. IE11) you will need to transpile the code with e.g. Babel.

Development

Run yarn install to install the dependencies. Then run yarn build to compile the library source files.