0.0.5 • Published 6 years ago
lesswork-hashids v0.0.5
lesswork-hashids
This is a hashids provider for the lesswork-framework
.
Installation
npm i --save lesswork-hashids
Register the provider and alias in your config/app.js
file.
const providers = [
...
'lesswork-hashids/providers/HashProvider',
];
const aliases = {
...
Hashids: 'Lesswork/Hashids',
};
Configuration
By default your key will be APP_KEY
.
You can adjust the configurations by creating the file config/hashids.js
'use strict'
module.exports = {
key: 'secret',
length: 5,
alaphabet: 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890',
};
Usage
See hashids for full usage information.
const Hashids = use('Hashids');
console.log(Hashids.encode(1));