DEV Community

Discussion on: Build your own URL shortener in 15 minutes

Collapse
 
craigz profile image
craigz

this is great and it 'works' inso as much as locally issuing the command 'npx short [URL]' generates a lovely shortened link using my custom domain, which it does write into the commonshost.json file. however, that link is unusable as attempts to connect to the url fail whichever browser i use. the cname for my custom domain is configured and working from the command line (it resolves to commons.host). deploying the site reports success although it also throws the following error: "(node:12208) [DEP0135] DeprecationWarning: ReadStream.prototype.open() is deprecated"

so as it stands, i have a nice framework and an npx command, but really in terms of doing anything with this, am unable to do so. i'm trying to wrap my head around the docs at commonshost, but lining up their default install with what's going on here with the redirects is not making a load of sense.

i'd be open to any suggestions as i'd love to move forward with this as a shortener and not be required to mess with php as most of the self hosted options seem to be using. i'm also not interested in using bit.ly as a backend.

thanks for an interesting start at least!

Collapse
 
sebdeckers profile image
Sebastiaan Deckers

Thanks for the bug report. πŸ™‡πŸΌβ€β™‚οΈ I'll take a look to see what needs to be updated in this blog post.

Collapse
 
sebdeckers profile image
Sebastiaan Deckers

Hey, could you tell me the domain name you're using? Might be a DNS or TLS certificate issue.

Finally got around to looking into the short tool. Refactored its code and added unit/regression tests. I also fixed that deprecation warning in the deploy tool. Just verified that it works on my machineℒ️. πŸ˜…

Will take a look at editing the Commons Host docs. Right now it's partly my own docs to configure the CDN platform, mixed in with docs for users of the various offered services (CDN, static hosting, DNS over HTTPS, even a Gopher client and proxy 😝).

Collapse
 
craigz profile image
craigz

hey, thanks for getting back to me!

after reading your comment i reviewed my notes and app from back then and gave it all another try and this time around things seem to work just fine. additionally, i've updated short to version 5.1.0 and sure enough, no more deprecation warning. most excellent. so i've got a working cli shortener.

now that it's working of course i want to take it further, i saw in another comment the link to the api which is exciting. i'm not entirely certain how to work with it, but i've started by installing @commonshost/short as a dev-dependency in a new project. i'm going to hack on this some over the weekend.