shortr

URL shortener and redirection

Stars
12

shortr

Package NuGet
Shortr Downloads
Shortr.AspNetCore Downloads
Shortr.Npgsql Downloads

A .NET Library for URL shortening and request redirection

This project can create short URLs (i.e: https://nugt.net/s/FqJFMC2) and redirect requests to the original URL.

You can see it in use in the NuGetTrends source code.

How does it work

It offers an in-memory store, for testing. And a Postgres extension package and an ASP.NET Core extension to plug it into the request pipeline.

It also includes a web app to demonstrate its use from a JavaScript client.

Configuration

By default it only generates links to URLs sharing the same BaseAddress as configured for the application itself. It's possible to change this behavior in different ways.

For example, allowing a direct URL to be created to any destination:

var options = new ShortrOptions 
{
  AllowRedirectToAnyDomain = true
}

The other options can be found here.

Run the Web project

Make sure you have .NET Core 3, docker and docker-compose to run PostgreSQL:

1. Start postgres with `docker-compose up`
2. Navigate to `src\Shortr.Web` and run `dotnet run`
3. Browser `http://localhost:5000`
Badges
Extracted from project README
Travis AppVeyor Tests codecov Codacy Badge Downloads Downloads Downloads