Giter Site home page Giter Site logo

aurum.js's Introduction

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:

{}

aurum.js's People

Contributors

wavpro avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.