npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

bermuda

v1.0.1

Published

[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy)

Downloads

3

Readme

Bermuda

Deploy

What is that?

This is a push-and-play shortener server to use your own domain to shorten URLs.

No database, no storage, no fees, no worries.

As fast and reliable as Google Shortener service (ahem) but with your own domain.

Just push to Heroku and start shortening.

How do I install it?

Simple.

1. Fork this repo

2. Tweak configuration, if needed

Configuration file is at the root, config.js. It is JS, not JSON, so no formating pressure.

  • apiKey: optional Google API key to use when shortening. I didn’t find a reason to do so just yet.
  • restrict: string or RegExp to restrict shortenable URLs. You may not want your shortener to be used to shorten links to NSFW websites.

3. Create an app on Heroku and push the code

You sure can use something else than Heroku, but it’s up to you to make it work elsewhere. You don’t need a paid app, a single free dyno will be more than enough.

4. Link your custom super-tiny domain to the app

Because short URLs beginning with http://floral-commotion-7635.herokuapp.com/ are not that short. HTTP or HTTPS, both are fine. This is actually the only thing you’ll have to pay.

How do I use it?

So let’s say you installed it and used your domain short.io.

You want to shorten {longUrl}.

Shorten

Request

GET, POST or PUT
http://short.io/{longUrl}

or

GET, POST or PUT
http://short.io/?longUrl={longUrl}

or

POST or PUT
http://short.io/
{
  "longUrl": "{longUrl}"
}

YES, the long URL is URL encoded in the URL or the query. Obviously.

Response

status: 200
body: "http://short.io/FWWiET"

or, if your Accept header begs for JSON:

status: 200
Content-Type: application/json
body: { "shortUrl": "http://short.io/FWWiET" }

Expand

Request

GET, PUT, POST
http://short.io/FWWiET

Response

status: 302
Location: "{longUrl}"

So people requesting the shortened URL will be redirected to the final URL. If you want to get the final URL, just don’t follow the redirection.

How does it work?

It internally uses Google Shortener API to shorten and expand URLs. That’s why it’s fast, reliable and free.

When you shorten a URL, it actually creates a goo.gl short URL and replaces http://goo.gl/ with your domain.

When you expand a short URL, it replaces your domain with http://goo.gl/, resolves this short URL with Google Shortener API and redirects to the final long URL.

So goo.gl URLs are never exposed to users.

Anything else?

Yes. There is a small lib to use the Google Shortener API itself. You could use just that, without using the bundled server.

What about tests?

I either wrote tests or this useless README file. That was my fastest decision-taking, ever.

Why “Bermuda”?

I love bad play on words. This is the worst I could come up with.

Who gives a shit?

I don’t.