npm.io
1.0.0 • Published 4 years ago

express-user-authentication

Licence
ISC
Version
1.0.0
Deps
0
Size
12 kB
Vulns
0
Weekly
0

Authentication Package

A package you can use to create a user system with authentications

Documentation

Setup

const expressAuthentication = require('express-user-authentication');
Create User
expressAuthentication.createUser({
  username: "Dinoscape",
  password: "MyPassword",
  data: {
    type: "User"
  }
});
Edit User
expressAuthentication.editUser({
  username: "Dinoscape",
  password: "MyPassword",
  options: {
    username: "DinoRunner",
    password: "SecurePassword",
    data: {
      type: "Admin"
    }
  }
});
Delete User
expressAuthentication.deleteUser({
  username: "DinoRunner",
  password: "SecurePassword"
});
Authentication
app.on("/admin", expressAuthentication({
  data: {
    type: "Admin"
  }
}), (req, res) => {
  res.send("You are an admin!");
})

Keywords