1.0.1 • Published 4 months ago
authilize v1.0.1
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
Functions | Description |
---|---|
isAuth | Function which checks if the user is authorized (retrieves bearer token from req) |
Installation
NPM:
npm install authilize
Yarn:
yarn add authilize