Create tinyurl/redirection service with ease.
Clone or download
dependabot[bot] and amio Bump tap from 12.0.1 to 12.0.2 (#29)
Bumps [tap](https://github.com/tapjs/node-tap) from 12.0.1 to 12.0.2.
- [Release notes](https://github.com/tapjs/node-tap/releases)
- [Changelog](https://github.com/tapjs/node-tap/blob/master/CHANGELOG.md)
- [Commits](tapjs/node-tap@v12.0.1...v12.0.2)

Signed-off-by: dependabot[bot] <support@dependabot.com>
1
Latest commit 7112dd5 Nov 13, 2018

README.md

now-go npm-version install-size

Create tinyurl/redirection service with ease.


Now go, let the legend come back to life!

Features

  • Lightweight tinyurl service (~50 sloc).
  • Three types of routes:
    • URL: redirect to an url
    • TEXT: echo a string
    • FUNCTION: accepts req argument, returns URL/TEXT routes
  • Deploy to now.sh with one command.

Quick Start

  • cli

    npm i -g now-go
    now-go -c path/to/config.json
  • programmatically

    const go = require('now-go')
    const config = require('./path/to/config.json') // routes config
    
    go(config)  // Start server on port 3000

Example configs

go-config.json

{
  // 302 redirection
  "/": "https://example.com",

  // echo text
  "/tag": "Now go, let the legend come back to life!",

  // "*" is a special route for unmatched path
  "*": "Yet another tinyurl service."
}

go-config.js

// redirect everything to new-example.com
module.exports = {
  "*": (req) => `https://new-example.com${req.url}`
}

Live Demo

License

MIT © Amio