Categorygithub.com/pkeorley/url-shortener
repository
0.0.0-20240726230747-5db57ded2908
Repository: https://github.com/pkeorley/url-shortener.git
Documentation: pkg.go.dev

# Packages

No description provided by the author

# README

url-shortener

MIT License


url-shortener is a service for shortening links using the Go programming language and packages such as GORM to interact with the PostgreSQL database and Fiber to create a web interface.

Update from 27/07/2024

I have decided that the entire codebase should be rewritten. ⚡ This is due to the low quality of the code, which limits the use of the service and architectural limitations that will make it impossible to use the service in other applications

Deployment

To deploy this project, run the following command

make build && ./bin/url-shortener

It starts the gofiber server on the port specified in the .env file

API Reference

Using a redirect to another site with a short name

GET /i/${shortname}
ParameterTypeDescription
shortnamestringRequired. The short name is the unique identifier assigned to the shortened link. When this endpoint is accessed with the appropriate short name, it redirects the user to the original URL associated with that short name

Creating a new shortened link

POST /api/v1/shortlinks/create
ParameterTypeDescription
api_keystringRequired. The API_KEY is a unique identifier. It is necessary for authentication and access control purposes
shortnamestringRequired The SHORTNAME is a user-defined alias or identifier for the shortened link. It helps users remember and identify the link easily
urlstringRequired The URL is the original long URL that needs to be shortened. It is the destination address that the shortened link will redirect to when accessed

License

This project is distributed under the terms of the MIT license.