A simple URL shortener service written in Go with SQLite for persistent storage.
- Shorten long URLs to easy-to-share short links
- Redirect short links to their original URLs
- Stores URLs with timestamps using SQLite
- Built with Go's standard library
Clone the repo and run:
go mod tidy
go run main.goThe server will start on http://localhost:8080.
-
POST
/shorten: Submit a JSON body with a URL to shorten.{ "url": "https://example.com/very/long/url" } -
GET
/{short}: Redirects to the original URL.
curl -X POST http://localhost:8080/shorten \
-H "Content-Type: application/json" \
-d '{"url":"https://example.com"}'Response:
{
"short_url": "http://localhost:8080/abc123"
}