1.0.1 • Published 4 months ago

authilize v1.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
4 months ago

Introduction

Library for authentication middleware using JWT

Code Samples

Initialize Authilize instance

const router = require("express").Router();
const { postController } = require("../controllers/controller");

const Authilize = require("Authilize");

const instanceAuth = new Authilize("JWT Secret Key", "Error Message", 401);

// POST
router.post("/post", instanceAuth.isAuth, postController);

module.exports = router;

List of functions

FunctionsDescription
isAuthFunction which checks if the user is authorized (retrieves bearer token from req)

Installation

NPM:

npm install authilize

Yarn:

yarn add authilize