Link Shortener is a simple service that uses SQLite for storing and managing shortened URLs. This Go-based application provides endpoints to shorten URLs and resolve them back to their original destination.
Shorten URLs: Convert long URLs into shorter, manageable links. Resolve Shortened Links: Redirect shortened links to their original URLs. Delete Shortened Links: Remove a shortened link and ensure it no longer redirects.
Go (Go 1.18 or later recommended)
git clone https://github.com/nilspolek/linkShortener.git
cd linkshortener
make runGET http://localhost:8080/<short>This request redirects to the original URL where short is the shortened link.
{
"destination": "https://example.com"
}returns
{
"short": "shortened"
}{
"destination": "https://example.com"
"short": ["<shortlink1>, <shortlink2>, ..."]
}The project includes tests to verify functionality. Run the tests with:
make testThe tests cover:
GET Request: Verify redirection from shortened link to the original URL. POST and DELETE Requests: Test creating, resolving, and deleting shortened links. Troubleshooting
Server Not Starting: Ensure no other services are running on port 8080. Database Issues: Check logs for errors and ensure the database file has the correct permissions.
Fork the repository Create a feature branch:
git checkout -b feature-branch
git commit -am 'Add new feature'
git push origin feature-branchOpen a Pull Request
This project is licensed under the MIT License. See the LICENSE