Skip to content

A fast and simple node.js library for URL shortening

License

Notifications You must be signed in to change notification settings

wavpro/aurum.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Aurum.js URL shortener

A fast and simple node.js library for URL shortening.
Install using npm:

npm i aurum

Examples

A list of examples on how to use the package.

Basic Redirection

const Redirect = require('@wavpro/aurum.js') 
const redirect = new Redirect('/', 3000)

redirect.listen()

Adding a redirect

const Redirect = require('@wavpro/aurum.js') 
const redirect = new Redirect('/', 3000)

redirect.listen()

//Programmatically add an URL
redirect.addURL('example', 'https://google.com/')

Getting info about an URL

const Redirect = require('@wavpro/aurum.js') 
const redirect = new Redirect('/', 3000)

redirect.listen()

//Programmatically get an URL
redirect.getURL('example')

Using with custom express setup

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)

Import data from YOURLS database

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')

Classes

A list of classes used by the package.

URL

Example:

URL {
  keyword: 'foobar',
  url: 'URL',
  clicks: 2
}

Redirect

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
}

Redirect.YOURLS

Example:

{}

About

A fast and simple node.js library for URL shortening

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published