@indepthwebsolutions/session-control
TypeScript icon, indicating that this package has built-in type declarations

1.0.7 • Public • Published

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" });

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i @indepthwebsolutions/session-control

      Weekly Downloads

      1

      Version

      1.0.7

      License

      MIT

      Unpacked Size

      2.42 kB

      Total Files

      4

      Last publish

      Collaborators

      • entrpyc