A fast and simple node.js library for URL shortening.
Install using npm:
npm i aurum
A list of examples on how to use the package.
const Redirect = require('@wavpro/aurum.js')
const redirect = new Redirect('/', 3000)
redirect.listen()
const Redirect = require('@wavpro/aurum.js')
const redirect = new Redirect('/', 3000)
redirect.listen()
//Programmatically add an URL
redirect.addURL('example', 'https://google.com/')
const Redirect = require('@wavpro/aurum.js')
const redirect = new Redirect('/', 3000)
redirect.listen()
//Programmatically get an URL
redirect.getURL('example')
const Redirect = require('@wavpro/aurum.js')
const express = require('express')
const app = express()
app.get('/', (req, res) => {
res.send('Hello world!')
})
const redirect = new Redirect('/', 3000)
redirect.listen('none', app)
The package also has a built in converter that converts data from a YOURLS database into the Augium format. Currently, it does not convert logs, as that seems to be problematic.
const Redirect = require('@wavpro/aurum.js')
const mysql = require('mysql')
var connection = mysql.createConnection({
host : 'foo',
user : 'bar',
password : 'SoSecret123',
database : 'foobar'
});
const convert = new Redirect.YOURLS(connection, 'prefix_', '/your/file/path/foo.json')
A list of classes used by the package.
Example:
URL {
keyword: 'foobar',
url: 'URL',
clicks: 2
}
Example:
Redirect {
_store: Store {
name: 'foo',
path: '/home/runner/ImprobableHumiliatingQuadrant/data/foo.json',
indent: 2,
debounce: 0,
defaults: {},
timeouts: {},
[Symbol(data-store)]: { urls: [Object], stats: [Object] }
},
_baseURL: '/',
_port: 3000
}
Example:
{}