Every successful Startup has a cool shortener service.
Woovi is no different, we have woo.vi as our shortener domain.
Benefits of a shortener domain
A short domain is easier to remember.
They are more suitable for SMS and social media where character limits are strict, like Twitter.
It can improve brand recognition.
They offer link analytics.
They increase CTR - Click-through rates.
Furthermore, they can redirect to other links.
Building Woovi Shortener Microservice
Here is a basic code of a shortener endpoint using Koa:
export const shortIdUrlGet = async ( ctx : Context ) => { const { id } = ctx . params ;
if ( ! id ) { return ctx . redirect ( ' https://woovi.com ' ); }
const shortener = await Shortener . findOne ({ shortId : id , });
if ( ! shortener ?. url ) { ctx . body = { error : ' Not found ' , };
return ; }
const queryString = ctx . querystring ? `? ${ ctx . querystring } ` : '' ;
ctx . redirect ( ` ${ shortener .…