Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nisaacson/account-logger
Log register and login requests to an account module
https://github.com/nisaacson/account-logger
Last synced: about 1 month ago
JSON representation
Log register and login requests to an account module
- Host: GitHub
- URL: https://github.com/nisaacson/account-logger
- Owner: nisaacson
- Created: 2013-04-30T21:53:31.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-05-01T04:35:40.000Z (over 11 years ago)
- Last Synced: 2024-10-05T07:47:24.096Z (about 1 month ago)
- Language: JavaScript
- Size: 141 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Account Couch Logger
Log register and login requests to an account module# Installation
```bash
npm install -S account-couch-logger
```# Usage
The account couch module exports `register` and `login` functionsTo register a new account, pass an `email`, `password` and a cradle `db` connection
```javascriptvar config = require('nconf').defaults({
couch: {
host: 'localhost',
port: 5984,
database: 'account_couch_test'
}
})
var logger = require('loggly-console-logger')
// instatiate an couchdb-based account backend object
var AccountCouch = require('account-couch')
var db = require('cradle-nconf')(config)
var data = {
email: '[email protected]',
password: 'barPassword',
db: db
}var accountCouch = new AccountCouch(db)
var AccountLogger = require('account-logger')// instatitate the account logger object, passing the couchdb-based account backend and the winston logger object as paramteres to the constructor
var account = new AccountLogger(accountCouch, logger)account.register(data, function (err, reply) {
if (err) {
inspect(err, 'error registering user account')
return
}
inspect(reply, 'account created correctly'
})
```# Test
To run the test suite execute```bash
# install development deps
npm install
# run tests
npm test
```