Create tinyurl/redirection service with ease.
Clone or download
dependabot[bot] and amio Bump tap from 12.0.2 to 12.1.0 (#30)
Bumps [tap](https://github.com/tapjs/node-tap) from 12.0.2 to 12.1.0.
- [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.2...v12.1.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
1
Latest commit 3f9b62c Nov 20, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci Create config.yml May 27, 2018
bin Add port options for cli May 15, 2018
test Add tests May 15, 2018
.gitignore Refactor code Mar 26, 2018
.npmignore Fix ocelot redirect 404 Jul 17, 2018
.travis.yml Update to node 10 in .travis.yml Apr 26, 2018
LICENSE (chore) docs cleanup May 17, 2018
README.md Fix npm badge url Jul 17, 2018
example.config.js Fix ocelot redirect 404 Jul 17, 2018
index.js Add tests May 15, 2018
now.json Add now.json May 15, 2018
ocelot.jpg (chore) docs cleanup May 17, 2018
package-lock.json Bump tap from 12.0.2 to 12.1.0 (#30) Nov 20, 2018
package.json Bump standard from 11.0.1 to 12.0.1 (#27) Sep 4, 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