Woo.vi – Building Woovi Shortener Microservice

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 …


This content originally appeared on DEV Community and was authored by Sibelius Seraphini

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.url}${queryString}`);
};

If no shortid was passed, we are going to return woovi.com, this is the logic that redirect woo.vi to woovi.com.

When passing a valid id we redirect to saved url in the Shortener model in our mongodb database.
We also forward querystring.

To generate the shortid, we use the open source package NanoId

In Conclusion

A shortener domain has many benefits, and your Startup should invest it to have one. The implementation is simple, it is just a key value mapping.

Here is a woo.vi link for you: https://woo.vi/nMfr8wekO4AI

Woovi
Woovi is a Startup that enables shoppers to pay as they like. To make this possible, Woovi provides instant payment solutions for merchants to accept orders.

If you want to work with us, we are hiring!

Photo by Michael Dziedzic on Unsplash


This content originally appeared on DEV Community and was authored by Sibelius Seraphini


Print Share Comment Cite Upload Translate Updates
APA

Sibelius Seraphini | Sciencx (2023-03-15T11:16:13+00:00) Woo.vi – Building Woovi Shortener Microservice. Retrieved from https://www.scien.cx/2023/03/15/woo-vi-building-woovi-shortener-microservice/

MLA
" » Woo.vi – Building Woovi Shortener Microservice." Sibelius Seraphini | Sciencx - Wednesday March 15, 2023, https://www.scien.cx/2023/03/15/woo-vi-building-woovi-shortener-microservice/
HARVARD
Sibelius Seraphini | Sciencx Wednesday March 15, 2023 » Woo.vi – Building Woovi Shortener Microservice., viewed ,<https://www.scien.cx/2023/03/15/woo-vi-building-woovi-shortener-microservice/>
VANCOUVER
Sibelius Seraphini | Sciencx - » Woo.vi – Building Woovi Shortener Microservice. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2023/03/15/woo-vi-building-woovi-shortener-microservice/
CHICAGO
" » Woo.vi – Building Woovi Shortener Microservice." Sibelius Seraphini | Sciencx - Accessed . https://www.scien.cx/2023/03/15/woo-vi-building-woovi-shortener-microservice/
IEEE
" » Woo.vi – Building Woovi Shortener Microservice." Sibelius Seraphini | Sciencx [Online]. Available: https://www.scien.cx/2023/03/15/woo-vi-building-woovi-shortener-microservice/. [Accessed: ]
rf:citation
» Woo.vi – Building Woovi Shortener Microservice | Sibelius Seraphini | Sciencx | https://www.scien.cx/2023/03/15/woo-vi-building-woovi-shortener-microservice/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.