Skip to content
/ elk-cli Public
forked from btholt/elk-cli

🌲🌲 Run your URL shortener (à la bit.ly) from the CLI using now

License

Notifications You must be signed in to change notification settings

jczimm/elk-cli

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Elk Logo

What is elk?

elk is a command line tool that allows you to deploy your own URL shortening service (like bit.ly). All you have to do is elk add /twitter https://twitter.com/holtbt and within seconds that URL on your domain will start forwarding.

How does it work?

elk is built on top of Zeit's now and zeit.world services. If you've never used these services, they're amazing and fantastic. now allows you to deploy node servers by simply typing now into the CLI of the directory you want to deploy. Within seconds your node server is out in the wild and publically available (they give you a URL to access it.) zeit.world is DNS configuration service. By typing now alias <your deployed now URL> <your own URL> your own domain will now be point at that deployed service (after you've pointed your domain's nameservers at Zeit's.) Be forewarned though that this feature that elk exploits is part of their paid tier (something they well deserve.) elk will still work without the paid tier; you just don't get custom domain support.

How do I get elk working?

  1. If you haven't, set up now
  2. If you want custom domain support, set up zeit.world on your domain.
  3. npm install --global elk-cli
  4. elk defaultAlias example.com (or whatever your custom domain is; you can skip this if you're not doing a custom domain)
  5. elk add /github https://github.com/btholt/elk
  6. Go to the URL (in this case https://example.com/github) and see it be redirected!

Commands

elk add <path> <url> <options>

Add a new redirect to your server. Deploys to now by default and aliases if a defaultAlias has been set. <path> is whatever the node requests receive as the path. Therefore / is the base URL as well as /example, /example?, and /example?other=1 are all different.

elk remove <path>

Remove a redirect from your server. Deploys to now by default and aliases if a defaultAlias has been set.

elk list

Lists defaultAlias and currently configured redirects

elk defaultAlias <alias>

Displays current defaultAlias if no alias is provided. If alias is provided, it sets it as the new defaultAlias. The alias can be anything that the now alias command understands. See their docs.

Options

-w or --wait

For add and remove, this will add or remove a redirect without deploying. Useful if you add a bunch of redirects but don't want to deploy until the end

-a <alias> or --alias <alias>

This will override whatever the defaultAlias is and set this to the alias after it deploys. The alias can be anything that the now alias command understands. See their docs.

-d or --debug

See the output from now and now alias

-n or --no-alias

Don't run the aliasing step

Contribute

Yes please!

License

MIT

About

🌲🌲 Run your URL shortener (à la bit.ly) from the CLI using now

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%