1.0.7 • Published 5 months ago

@indepthwebsolutions/session-control v1.0.7

Weekly downloads
-
License
MIT
Repository
-
Last release
5 months ago

Control Node Sessions

Usage

This package is designed for Indepth Solutions LTD. for managing node sessions with a high level abstraction of express. It can be used for other purposes too.

Installation

NPM

  npm i @indepthwebsolutions/session-control

YARN

  yarn add @indepthwebsolutions/session-control

On your server add this env variable:

.env

INDEPTH_AUTH_KEY=put_your_key_here

In your request body, you must include this security token:

headers: {
  'Authorization': 'Indepth-Auth-Key put_your_key_here',
}

Usage

  import Session from '@indepthwebsolutions/session-control';

  const session = new Session({ req, requiredParams: [ 'text', 'source_lang', 'target_lang' ] });

  if(!session.isAuthorized()) return res.status(400).json({ error: "named error" });

  if (!session.hasRequiredParams()) return res.status(400).json({ error: "named error" });
1.0.7

5 months ago

1.0.6

7 months ago

1.0.5

7 months ago

1.0.4

7 months ago

1.0.3

7 months ago

1.0.2

7 months ago

1.0.1

7 months ago

1.0.0

7 months ago