2

In the current version of node, importing modules as functions looks like this:

// case 1:
const MongoStore = require('connect-mongo')(session)

// case: 2
const LocalStrategy = require('passport-local').Strategy

However, I am using es2015 syntax in my express server, which looks like this:

import MongoStore from 'connect-mongo'
import LocalStrategy from 'passport-local'

How can I pass session as a function parameter to the import statement, or append the Strategy method?

55 Cancri
  • 1,075
  • 11
  • 23

1 Answers1

5

For MongStore, you just need to execute the function and pass the session.

import MongoStore from 'connect-mongo'

var mongoStore = MongoStore(session);

For LocalStrategy you can do the following:

import { Strategy as LocalStrategy} from 'passport-local'
Amr Labib
  • 3,995
  • 3
  • 19
  • 31