🔗 Redirect
Repository developed to practice knowledge in ASP .NET Core using C#, .NET 6, Clean Architecture, CQRS, Entity Framework Core, Dapper and Repository Pattern. This project is a URL shortener and uses PostgreSQL as a database.
📫 Routes
Url Shortener Controller
"/generate-new-shortened-url"
Generates a new shortened url code for the original informed url
body:
{
"originalUrl": string
}
response:
{
"shortenedUrl": string
}
"/{code}"
Redirects to the original url from the entered short url code, if the code does not exist in the database, 404 is returned.
route params:
code: string
response:
Redirect Result to the original url
🌐 Status
Finished project ✅
🧰 Prerequisites
-
.NET 6.0 or +
-
Connection string to PostgreSQL BD in redirect/Redirect.API/appsettings.json named as ConnectionStrings.RedirectCs
Database
Create a database in PostgreSQL that contains the table created from the following script:
CREATE TABLE public."shortenedURLs"
(
"Code" character varying(10) NOT NULL,
"OriginalURL" character varying(2048) NOT NULL,
"Expiration" timestamp without time zone NOT NULL,
PRIMARY KEY ("Code")
);
🔧 Installation
$ git clone https://github.com/AllanDutra/redirect.git
$ cd redirect/Redirect.API
$ dotnet restore
$ dotnet run
Server listenning at https://localhost:7272/!