membership-mysql-store

0.0.25 • Public • Published

membership-mysql-store

A MySQL store for membership.js

Installation

Add to your application via npm:

npm install membership-mysql-store --save

This will install membership-mysql-store and add it to your application's package.json file.

How to Use

Use with your express session middleware, like this:

var MysqlMembershipStore = require("membership-mysql-store");

var options = {
	host: 'localhost',
	port: 3306,
	user: 'session_test',
	password: 'password',
	database: 'session_test',
	syncDB: false
};

var mysqlMembershipStore = new MysqlMembershipStore(options);

mysqlMembershipStore.createUser({
	email: "mail@example.com"
}, "hashedpassword").then(function(user){
	console.log(user);
}).catch(function(error){
	console.error(error);
});

Debugging

express-mysql-session uses the debug module to output debug messages to the console. To output all debug messages, run your node app with the DEBUG environment variable:

DEBUG=express-mysql-session* node your-app.js

This will output log messages as well as error messages from express-mysql-session.

If you also might need MySQL-related debug and error messages, include mysql-connection-manager as well:

DEBUG=express-mysql-session*,mysql-connection-manager node your-app.js

Configure Local Environment

Step 1: Get the Code

First, you'll need to pull down the code from GitHub:

git clone https://github.com/ErezAlster/membership-mysql-store.git

Step 2: Install Dependencies

Second, you'll need to install the project dependencies as well as the dev dependencies. To do this, simply run the following from the directory you created in step 1:

npm install

Step 3: Set Up the Test Database

Now, you'll need to set up a local test database:

{
	host: 'localhost',
	port: 3306,
	user: 'session_test',
	password: 'password',
	database: 'session_test',
	syncDB: true
}

The test database settings are located in test/config.json

Running Tests

With your local environment configured, running tests is as simple as:

npm test

Readme

Keywords

none

Package Sidebar

Install

npm i membership-mysql-store

Weekly Downloads

1

Version

0.0.25

License

MIT

Last publish

Collaborators

  • erezalster