Menu

Woo.vi - Building Woovi Shortener Microservice
📰

Woo.vi - Building Woovi Shortener Microservice

DEV Community: koa·Sibelius Seraphini·8 months ago
#cWwoVoH7
#devtokoa#devto#dev#shortener#woovi
Long article (331 words) — no AI summary yet.
Reading 0:00
15s threshold

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 .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.