Git Product home page Git Product logo

now-go's Introduction

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

now-go's People

Contributors

amio avatar dependabot-preview[bot] avatar dependabot[bot] avatar greenkeeper[bot] avatar greenkeeperio-bot avatar minigod avatar snyk-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

now-go's Issues

An in-range update of node-fetch is breaking the build 🚨

☝️ Greenkeeper’s updated Terms of Service will come into effect on April 6th, 2018.

Version 2.1.0 of node-fetch was just published.

Branch Build failing 🚨
Dependency node-fetch
Current Version 2.0.0
Type dependency

This version is covered by your current version range and after updating it in your project the build failed.

node-fetch is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details

Release Notes Version 2.1.0

See CHANGELOG:

  • Enhance: allow using ArrayBuffer as the body of a fetch() or Request
  • Fix: store HTTP headers of a Headers object internally with the given case, for compatibility with older servers that incorrectly treated header names in a case-sensitive manner
  • Fix: silently ignore invalid HTTP headers
  • Fix: handle HTTP redirect responses without a Location header just like non-redirect responses
  • Fix: include bodies when following a redirection when appropriate
FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

302 redirect for "?" route

Currently, redirecting "?"s with 301 will make clients cache the redirect of a route that doesn't exist (yet).

In production, this will probably not be an issue, but it's probably better to redirect with 302 so that the client will call the server again.

An in-range update of standard is breaking the build 🚨

Version 9.0.2 of standard just got published.

Branch Build failing 🚨
Dependency standard
Current Version 9.0.1
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As standard is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪


Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details
Commits

The new version differs by 4 commits .

See the full diff.

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Allow setting remote config url using env variable

It would be great if I could deploy now-go directly from this repo and point to the config using an env variable.

Something like

now -e NOW_GO_CONFIG=http://example.com/config.json amio/now-go
now alias https://now-go-ab78a901.now.sh/ short.example.com

I'm already hosting my website on gh-pages, so I could easily update the config there without having to create a new repo only for the shorturl service.

An in-range update of micro is breaking the build 🚨

Version 7.1.0 of micro just got published.

Branch Build failing 🚨
Dependency micro
Current Version 7.0.6
Type dependency

This version is covered by your current version range and after updating it in your project the build failed.

As micro is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this 💪


Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details
Release Notes 7.1.0

Minor Changes

  • Add status fallback to error handling: #164

Patches

  • Fix(package): update args to version 2.3.0: #151
  • Include whole entrypoint directory to be compiled: #152
  • Use bluebird instead of Q: #153
  • Fix(package): update update-notifier to version 2.1.0: #160
  • Chore(package): update ava to version 0.18.2: #161
  • Lazy load async-to-gen/register: #162
  • Lowercased text files: bd4a13f
  • Chore(package): update husky to version 0.13.2: #165
  • Fix(package): update ip to version 1.1.5: #166
  • Chore(package): update request to version 2.80.0: #167
  • Tell Travis to test on node LTS: ab5c8a2
  • Fix transpilation on Windows platform: 8a597c0
  • Remove bluebird.coroutine: #163
  • Bumped bluebird and xo to latest version: 179a0e9
  • Updated lockfile for Yarn: 94476e7

Credits

Huge thanks to @dotcypress, @timneutkens, @iamstarkov and @floatdrop for their help!

Commits

The new version differs by 19 commits .

  • 50e95f5 7.1.0
  • 94476e7 Updated lockfile for Yarn
  • 179a0e9 Bumped bluebird and xo to latest version
  • 786ee1a Remove bluebird.coroutine (#163)
  • 8a597c0 Fix transpilation on Windows platform
  • ab5c8a2 Tell Travis to test on node LTS
  • 9b33adb Add status fallback to error handling (#164)
  • eaa1d42 chore(package): update request to version 2.80.0 (#167)
  • 5218114 fix(package): update ip to version 1.1.5 (#166)
  • 006bc2f chore(package): update husky to version 0.13.2 (#165)
  • 230d3cd Updated lockfile for Yarn
  • bd4a13f Lowercased text files
  • d614ea4 lazy load async-to-gen/register (#162)
  • cdf15dc chore(package): update ava to version 0.18.2 (#161)
  • e70b259 fix(package): update update-notifier to version 2.1.0 (#160)

There are 19 commits in total. See the full diff.

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Version 10 of node.js has been released

Version 10 of Node.js (code name Dubnium) has been released! 🎊

To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:

  • Added the new Node.js version to your .travis.yml
  • The new Node.js version is in-range for the engines in 1 of your package.json files, so that was left alone

If you’re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.

More information on this issue

Greenkeeper has checked the engines key in any package.json file, the .nvmrc file, and the .travis.yml file, if present.

  • engines was only updated if it defined a single version, not a range.
  • .nvmrc was updated to Node.js 10
  • .travis.yml was only changed if there was a root-level node_js that didn’t already include Node.js 10, such as node or lts/*. In this case, the new version was appended to the list. We didn’t touch job or matrix configurations because these tend to be quite specific and complex, and it’s difficult to infer what the intentions were.

For many simpler .travis.yml configurations, this PR should suffice as-is, but depending on what you’re doing it may require additional work or may not be applicable at all. We’re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, I’m a humble robot and won’t feel rejected 🤖


FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of micro is breaking the build 🚨

☝️ Greenkeeper’s updated Terms of Service will come into effect on April 6th, 2018.

Version 9.1.1 of micro was just published.

Branch Build failing 🚨
Dependency micro
Current Version 9.1.0
Type dependency

This version is covered by your current version range and after updating it in your project the build failed.

micro is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details

Release Notes 9.1.1

Patches

  • Removed triangle from company name: 08146dd
  • No transpilation needed anymore: 62f3e45
  • Support es6 module default export: #336
  • Remove unused var from with-graphql example: #342
  • Lint Socket.IO Example: #341
  • Create README file for https example: #340
  • Splat listen() args to only specify host when supplied: #347

Credits

Huge thanks to @tungv and @fmiras for helping!

Commits

The new version differs by 8 commits.

  • fa91ddc 9.1.1
  • 3191eea splat listen() args to only specify host when supplied (#347)
  • 3b33de0 Create README file for https example (#340)
  • 1248351 Lint Socket.IO Example (#341)
  • 14b097a Remove unused var from with-graphql example (#342)
  • dd2a4bb [WIP] feat: support es6 module default export (#336)
  • 62f3e45 No transpilation needed anymore
  • 08146dd Removed triangle from company name

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of standard is breaking the build 🚨

☝️ Greenkeeper’s updated Terms of Service will come into effect on April 6th, 2018.

Version 11.0.1 of standard was just published.

Branch Build failing 🚨
Dependency standard
Current Version 11.0.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

standard is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details

Commits

The new version differs by 20 commits.

  • 670a3be authors
  • b7e6cbc 11.0.1
  • 34a3c40 Merge pull request #1092 from watson/elastic-logo
  • 5382643 Replace Opbeat with Elastic logo
  • c40c799 Merge pull request #1091 from mackermans/master
  • 504fcff docs(README): update typeform logo
  • a5b779f Swap README.md and RULES.md symlinks (#1090)
  • e818224 Merge pull request #1072 from standard/greenkeeper/eslint-plugin-react-7.7.0
  • 9dc888f Merge branch 'master' into greenkeeper/eslint-plugin-react-7.7.0
  • a5293dd Merge pull request #1075 from standard/greenkeeper/eslint-plugin-import-2.9.0
  • ebf6620 Merge pull request #1087 from standard/greenkeeper/eslint-plugin-promise-3.7.0
  • 116a871 fix(package): update eslint-plugin-promise to version 3.7.0
  • 738edc4 readme: add standard talk
  • c93ac0d Merge pull request #1076 from tumobi/fix-links
  • 4f8c1f5 Fix webstorm.md links

There are 20 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

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.