2.1.4 • Published 7 years ago

apeman-api-sign v2.1.4

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

apeman-api-sign

Build Status Code Climate Code Coverage npm Version JS Standard

Sign API for apeman

Installation

$ npm install apeman-api-sign --save

Usage

Define a module in Apemanfile and run the server.

/** Example of Apemanfile.js */

'use strict'

const co = require('co')

let { NODE_ENV } = process.env


module.exports = {
  $cwd: __dirname,
  $pkg: { /* ... */ },
  $proto: [ /* ... */ ],
  $api: {
    // Define APIs
    'sign': require('apeman-api-sign')(
      User, UserSign,
      {
        logging: NODE_ENV === 'development'
      }
    )
  }
}

Then, call the module from client script

#!/usr/bin/env node

/**
 * Example client
 */
'use strict'

const co = require('co')
const apemanApiClient = require('apeman-api-client')

co(function * () {
  // Setup an client
  let api = yield apemanApiClient('/api')

  // Connect to a module
  let sign = yield api.connect('sign')
  let pong = yield sign.ping()
  /* ... */

  yield sign.signup('hoge', 'hoge@example.com', '!Jasdp08u')
})

Methods

The following methods are provided by the API.

.ping(pong)

Test the reachability of the api.

ParamTypeDescription
pongstringPong message to return

.signup(key, email, password, options)

ParamTypeDescription
keystringUser key to signup
emailstringUser email to signup
passwordstringUser password to signup
optionsObjectOptional settings

.signin(key, password)

Do sign in

ParamTypeDescription
keystringUser key or email to signup
passwordstringUser password

.signget()

Get signing data

.signmod(keys, password)

Modify sign data

ParamTypeDescription
keysobjectSign keys to update
passwordstringPassword to update

.signout()

Do signout

.signdel()

Delete sign data

.check(password)

Check password is valid

ParamTypeDescription
passwordstring

License

This software is released under the MIT License.

Links

2.1.4

7 years ago

2.1.3

7 years ago

2.1.2

7 years ago

2.1.1

7 years ago

2.1.0

7 years ago

2.0.8

8 years ago

2.0.7

8 years ago

2.0.6

8 years ago

2.0.5

8 years ago

2.0.4

8 years ago

2.0.3

8 years ago

2.0.2

8 years ago

2.0.1

8 years ago

2.0.0

8 years ago

1.0.14

8 years ago

1.0.13

8 years ago

1.0.12

8 years ago

1.0.11

8 years ago

1.0.10

8 years ago

1.0.9

8 years ago

1.0.8

8 years ago

1.0.7

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago