• Stars
    star
    112
  • Rank 312,240 (Top 7 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 8 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Create tinyurl/redirection service with ease.

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
  • create http handler

    const http = require('http')
    const { createHandler } = require('now-go')
    
    const config = require('./path/to/config.json')
    const handler = createHandler(config)
    
    http.createServer(handler).listen(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

More Repositories

1

awesome-micro

A collection of awesome things regarding zeit's micro.
1,071
star
2

emoji.json

Just an emoji.json
JavaScript
290
star
3

re-carousel

Minimal carousel component for React.
JavaScript
272
star
4

npm-why

Identifies why a package has been installed. Equivalent to `yarn why` for npm packages.
JavaScript
171
star
5

console.js

A game console (video game cli) for browsers.
JavaScript
115
star
6

embedded-google-fonts

Embed (base64 encoded) google fonts into css.
JavaScript
105
star
7

micro-fork

Fast and functional router
JavaScript
97
star
8

eloc

A CLI for presentations in markdown
TypeScript
59
star
9

nls

Missing inspector for npm packages.
JavaScript
54
star
10

pageshot

Pageshot as a service.
JavaScript
47
star
11

hyper-blink

Let Hyper's cursor blink.
JavaScript
42
star
12

git-cheatsheet-chs

Git Cheatsheet 中文版
JavaScript
36
star
13

font-mess

Obscure text with messed font.
JavaScript
34
star
14

flaming-disk-usage

Find out who's burning my precious disk
JavaScript
26
star
15

alfred-emoji-finder

Find relevant emoji from text
23
star
16

marked

Markdown rendering as a service.
JavaScript
21
star
17

serverless-zhcn

无服务器架构(Serverless Architectures)
CSS
20
star
18

markdown-deck

A web component for presenters
TypeScript
17
star
19

measurement-protocol

Human friendly tracking with Google's Universal Analytics via Measurement Protocol.
TypeScript
15
star
20

node-submod

A subtitle(ass/srt) toolkit for modifing synchronization, encoding, etc.
JavaScript
15
star
21

youtube-screenshot-button

Add screenshot button to youtube.com
JavaScript
15
star
22

fish-theme-eden

A customizable theme for fish shell.
Shell
12
star
23

docdock

App launcher for devdocs.io.
JavaScript
11
star
24

userscript-parser

Userscript metadata parser.
JavaScript
10
star
25

gh-index

A directory index for gh-pages.
JavaScript
10
star
26

docker-node-chrome

Dockerfile for nodejs + chrome.
Dockerfile
10
star
27

pull-request-guide

团队协作 Pull-Request 书写指南
10
star
28

my-way

Robust path matcher in 738 bytes.
TypeScript
9
star
29

node-pingrace

A ping race program.
JavaScript
9
star
30

serve-marked

Serve README.md at ease
TypeScript
9
star
31

hyper-final-say

Allows local config override any plugin or theme settings applied on top of the defaults `./.hyper.js`.
JavaScript
9
star
32

fe-lenses

Full-frame E-mount lenses catalog.
JavaScript
8
star
33

pug-playground

Pug Playground
JavaScript
7
star
34

node-orn

Oh Rename, rename files like JavaScript String.replace()
JavaScript
6
star
35

cron

Amio's cron jobs with GitHub Actions
JavaScript
6
star
36

now-deploy-badge

"Deploy to Now" badge for GitHub READMEs
6
star
37

amio.github.com

Amio on Github
CSS
5
star
38

gulp-all

Promise.all for gulp streams, so you can compose a bunch of "private" subtasks.
JavaScript
5
star
39

npm-mirrors

A list for npm registry mirrors.
JavaScript
4
star
40

qr-cli

Minimal viable QR code generator in terminal.
JavaScript
3
star
41

timeout

An endpoint for timeout testing
JavaScript
3
star
42

yarn-why

Identifies why a package has been installed (by yarn.lock)
JavaScript
3
star
43

b-decks

Amio's presentations at bytedance
HTML
2
star
44

require-cjs-string

Load commonjs module from string in Node & Browser.
JavaScript
2
star
45

dev-splash

HTML
2
star
46

otwlist

掐头去尾的科学上网清单
2
star
47

bbdemo

Backbone demo with Require.js
JavaScript
2
star
48

send-beacon

Beacon API for Node.js
JavaScript
2
star
49

metalmonkey

Modern userjs manager.
JavaScript
2
star
50

comets

Create a one-off server for testing http request listener
TypeScript
2
star
51

base64

Encodes and decodes base64 within browser.
JavaScript
1
star
52

uuid.now.sh

TypeScript
1
star
53

now-firestore

JavaScript
1
star
54

tba

A minimal placeholder page for domains just bought.
HTML
1
star
55

tm-i2

Tampermonkey interface redesigned.
CSS
1
star
56

chrome-daemon

Manage Google Chrome instance with Node.js.
JavaScript
1
star
57

vue-examples

JavaScript
1
star
58

shu.now.sh

阿拉伯数字转中文数字
JavaScript
1
star
59

mrrobot-comments

Mr Robot post-episode comments
1
star
60

userscript-cli

Cli for making userscript
JavaScript
1
star
61

cli

Automatically exported from code.google.com/p/amio
JavaScript
1
star
62

koa-mustache

Serve mustache with data (optional)
JavaScript
1
star
63

multi-ghost

A setup for multiple ghost blogs.
JavaScript
1
star
64

echo-path.vercel.app

TypeScript
1
star
65

docker-node-chrome-cjk

Dockerfile for nodejs + chrome + cjk fonts.
1
star
66

attempts

Try function with different args.
JavaScript
1
star
67

atom-jsdoc-preview

JSDoc preview in Atom.
1
star
68

nrm

Minimal npm registry manager. (Like `nrm` but without bundling a huge `npm`.)
JavaScript
1
star
69

holmes

A dock for homes.
JavaScript
1
star
70

yo

Begin app
JavaScript
1
star
71

webpack2-example

JavaScript
1
star
72

alfred-addons

Amio's alfred addons
CSS
1
star