userz
v0.1.1
Published
A small module for Express that takes care of redundant aspects of user-management. The module adds the required endpoints to your project, provides events, authentication-middleware and exposes its controller-functions for direct manipulation in your cor
Downloads
4
Readme
Description
A small module for Express that takes care of redundant aspects of user-management. The module adds the required endpoints to your project, provides events, authentication-middleware and exposes its controller-functions for direct manipulation in your core project.
Features
- Register Users
- Verify Users
- Change E-Mail Addresses
- Handle forgotten Passwords
- Authenticating Users
- Disabling/Blacklist Users
Requirements (for now)
- Express
- MongoDB
Basic Usage
auth.js
const Userz = require('userz')
const app = require('../app')
const mongoose = require('mongoose')
// initiate
let userz = Userz({
mongoose,
secret: process.env.JWT_SECRET
config: {
authTokenExpiration:"1d",
cookieName: "token",
passwordValidation: password => password.length > 5,
disableErrorHandling: false
}
})
app.use('/auth', userz.routes)
module.exports = userz // {middleware, events, controllers, routes}