Live data from Hacker News

Show HN: I created a URL shortener that can be entirely hosted on GitHub Pages

github.com

71–80 of 182 posts

Re: Show HN: I created a URL shortener that can be entirely hosted on GitHub Pages

#71

Earlier quoted context omitted.

What I meant was that GitHub's API does not check for the Host header, and the API allows connections from any source. Thus, CORS isn't an issue at all.

But the same-origin policy implemented by your browser should prevent the request before it gets anywhere near the API.

No, when a script tells a browsers to make a cross-origin request such as a GET or POST, the browser first makes a "pre-flight" request (without the payload) using the OPTIONS method to see what CORS-related response headers come back. If headers are returned that allow for it to proceed, the browser then makes whatever request the script asked for.

The network tab of developer tools should reveal all of this.

Re: Show HN: I created a URL shortener that can be entirely hosted on GitHub Pages

#72
post #57

Such a fun little hack. The killer feature is that you found a way for anyone to create a new short URL without a pull request or any changes to the original repository. Nice work.

Thank you for the kind comments! That's was the aim of the project, to make it fun and easy to create new short links!

Re: Show HN: I created a URL shortener that can be entirely hosted on GitHub Pages

#73
post #52

3425 lines in package-lock.json for a "Minimal URL shortener" https://github.com/nelsontky/gh-pages-url-shortener/blob/mai...

And all that is just for being able to write `response = await fetch(...)` instead of `fetch(...).then(...)`.

My fault. Didn't know that ES2015 actually supported `.then()`. Anyway, this was also an exercise for me to learn about babel (I use CRA all the time so have no idea what is going on behind the scenes) and this was a nice intro!

Re: Show HN: I created a URL shortener that can be entirely hosted on GitHub Pages

#74

3425 lines in package-lock.json for a "Minimal URL shortener" https://github.com/nelsontky/gh-pages-url-shortener/blob/mai...

I figured that since the dependencies were only used in the build step it's not really considered. That being said, I didn't know ES2015 had `.then()` and was kinda trying out babel since I always used CRA and never knew what was going on behind the scenes. The dependencies were definitely not needed but in the production build, they aren't really "unminimal"

Re: Show HN: I created a URL shortener that can be entirely hosted on GitHub Pages

#75

> Unlike many URL shorteners, this one does not need a database and can be entirely hosted on GitHub pages. it does need a database though. it just uses someone else's database

HAHA yes it does opps slightly clickbait

HAHA roasted

Re: Show HN: I created a URL shortener that can be entirely hosted on GitHub Pages

#77
post #66

Earlier quoted context omitted.

I think the example on your home page would look better as https://mysto.re/buy-shoes https://en.wikipedia.org/wiki/.re

Wow! Thanks. That's way better.

Yeah. It is a popular feature in link shortners. Looks a lot better and has a premium feeling.

Examples are youtu.be , goo.gl , redd.it , cbsn.ws

Re: Show HN: I created a URL shortener that can be entirely hosted on GitHub Pages

#80

Earlier quoted context omitted.

How come I couldn’t find your service when I was looking for alternatives for bitly? The only results I got via Google, product hunt ... services that were overpriced and very limiting (nr of teammates)

I launched this a few months ago so getting to the first page of google search results is a bit challenging.

Maybe allow users to shorten links for free (without account) so that your domain becomes recognizable. bitly became popular that way

And target enterprises with custom URL's. They look very good

Maybe copy some features adjust has (deep linking and redirecting to respective app stores with tracking parameters)

https://www.adjust.com/glossary/deep-linking/

Post reply on HN