README
apeman-api-recover
Recover API for apeman
Installation
$ npm install apeman-api-recover --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
let { User, UserSign, UserRecover } = require('./example-models')
module.exports = {
$cwd: __dirname,
$pkg: { /* ... */ },
$proto: [ /* ... */ ],
$api: {
// Define APIs
'module01': require('apeman-api-recover')(
User, UserSign, UserRecover,
{
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 recover = yield api.connect('module01')
let pong = yield recover.ping()
/* ... */
yield recover.issue('hoge@example.com')
})
Methods
The following methods are provided by the API
.ping(pong)
Test the reachability of the api.
Param | Type | Description |
---|---|---|
pong | string |
Pong message to return |
.issue(email)
Issue recover token to email
Param | Type | Description |
---|---|---|
string |
.check(token)
Confirm email
Param | Type | Description |
---|---|---|
token | string |
Recover token |
.update(token, newPassword)
Update password
Param | Type | Description |
---|---|---|
token | string |
Recover token |
newPassword | string |
New password |
.one(id)
Get an recover
Param | Type | Description |
---|---|---|
id | string |
.last(email)
Get last recover for current user
Param | Type | Description |
---|---|---|
string |
License
This software is released under the MIT License.