Skip to content

Hooks

Choose a tag to compare

@simplymichael simplymichael released this 02 Jan 13:17
· 8 commits to master since this release

⚠ BREAKING CHANGES

  • app (new methods):
    • SESSION_TOKEN_KEY deprecated in favour of SESSION_SECRET
    • AUTH_TOKEN_KEY deprecated in favour of AUTH_TOKEN_SECRET
    • PASSWORD_BLACK_LIST deprecated in favour of DISALLOWED_PASSWORDS
  • app (src/index.js):
    • express-user-manager.getDbDriver() has been removed. Calls to it will error.

    • express-user-manager.getDbAdapter(adapter) no longer returns a constructor, instead it returns an object.
      This means the following no longer works:

      const DataStore = userManager.getDbAdapter(adapter);
      const store = new DataStore(); // Error: DataStore is not a constructor
      
      userManager.set('store', store);
      

      Do this instead: const store = userManager.getDbAdapter(adapter);

      This still performs all the previous initialization steps, but internally.

✨ Features

  • app (src/index.js): simplify the API setup (e49c432)
    • Run initialization and setup tasks, including connecting to the DB and listening for connections, in one call via await userManager.init(app, configObject);
  • app (new methods): add new configuration and initialization methods: userManager.config(), userManager.init() (8e306ef)
    • specify configuration properties via userManager.config(configOptions);
    • database connection parameters can now be specified in 3 ways:
      • via userManager.config()
      • via environment variables (which can be set using a .env file at the root of your project),
      • calling userManager.getDbAdapter(adapter).connect(connectionOptions); and passing in the connection options
  • routing: implement user data update route (f487bf0)
  • hooks: define custom middlewares for hooking into the request-response cycle