Skip to content
Create tinyurl/redirection service with ease.
Branch: master
Clone or download
1
Latest commit 73da4d4 Mar 20, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
bin Add port options for cli May 15, 2018
example
test Fix test Mar 20, 2019
.gitignore
.npmignore upgrade to now v2 Jan 29, 2019
.travis.yml
LICENSE (chore) docs cleanup May 17, 2018
README.md
index.js
now.json Update deploy config Mar 20, 2019
ocelot.jpg
package-lock.json Fix test Mar 20, 2019
package.json Bump supertest from 3.4.2 to 4.0.0 (#41) Mar 13, 2019

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

You can’t perform that action at this time.