npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

authrm

v1.0.1

Published

An npm package for authentication

Downloads

2

Readme

AUTHRM

A npm package for authentication.

Tech Stack

Server: Node

Requirements

Your user model should contain atleast these points.

    username: { type: String, required: true, unique: true },
    email: { type: String, required: true, unique: true },
    password: { type: String, required: true }

How to use?

Import

Import this package using npm i authrm

Configuration

authrm.config(userModel, tokenSecret, tokenExpiry);
  • userModel: This is path to your user model.
  • tokenSecret: This is JWT token secret-key you want to set.
  • tokenExpiry: This is JWT token expiry time.

functionalities

  1. SignIn
authrm.signIn(req,res);
  • This takes req and res objects as a parameter.
  • This returns an object.
    • If there are no errors occured then object contains status code as status, user which has been signed in or signed up, message and jwt token.
    return {
                status,
                user,
                message,
                token
            };
    • If there is error then object contains status code as status and error which specifies the error.
    return {
                status,
                error
            }
  1. SignUp
authrm.signUp(req,res);
  • This also returns same objects as signIn.
  1. SignOut
authrm.signOut(req,res,tokenName);
  • This takes an extra parameter called tokenName which is the token you want to delete on signout function.

  • This will return an object containing status and message fields in case of no errors. And in case of errors it will return an object containing status and error fields.

  1. Change password
authrm.changePassword(req,res);
  • This checks weather user has entered correct current password.
  • If yes then replaces the password and returns an object containing status, message and user fields.
  • In case of error it returns an object containing status and error fields.