0.1.21 • Published 4 years ago

feather-server-node v0.1.21

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

Feather Node.js Library

npm

This library provides a convenient interface to the Feather API for applications running in a Node.js server environment.

Installation

$ npm install feather-server-node --save
# or
$ yarn add feather-server-node

Usage

The Feather package must be initialized with your project's API key, available on the Feather Dashboard. Include the API key when you require the package:

const feather = require("feather-server-node")("live_...");

Using Promises

Every method returns a promise:

feather.credentials
  .create({
    type: "username|password",
    username: "jdoe",
    password: "pa$$w0rd"
  })
  .then(credential => {
    return feather.sessions.create({
      credential_token: credential.token
    });
  })
  .then(session => {
    return feather.users.retrieve(session.user_id);
  })
  .then(user => {
    // User of the newly created session
  })
  .catch(error => {
    // Handle errors
  });

Development

If you do not have yarn installed, you can install it with npm install --global yarn.

Run the tests:

$ yarn install
$ yarn test

More Information