Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update docs to detail usage with ES6 #148

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,18 @@ The session store will internally create a mysql2 [connection pool](https://gith

The sessions database table should be automatically created, when using default options. If for whatever reason the table is not created, you can find the schema [here](https://github.com/chill117/express-mysql-session/blob/master/schema.sql).


### Using ES6?

When using ES6 modules, you can't immediately invoke a function in an import statement like with CommonJS's `require`. Instead you can import `express-mysql-session` and then create an instance of the MySQLStore by invoking the imported module with `session`.
```javascript
import session from 'express-session';
import MySQLSession from 'express-mysql-session';

const MySQLStore = MySQLSession(session);
// Use MySQLStore with your session configuration as normal etc...
```

### Use an existing MySQL connection or pool

To pass in an existing MySQL database connection or pool, you would do something like this:
Expand Down