This is a simple URL shortener application built in Go using the Gin web framework, SQLite for persistent storage, and Redis for caching.
- Shorten long URLs to shorter, more manageable ones.
- Resolve short URLs to their original long URLs.
- Uses SQLite for persistent storage and Redis for caching.
- Go (version 1.13 or higher)
- SQLite
- Redis
-
Clone the repository:
git clone https://github.com/your-username/url-shortener.git cd url-shortener
-
Install dependencies:
go mod tidy
-
Run the application:
go run main.go database.go redis.go
-
Access the application:
Open your browser and go to
http://localhost:8080
to access the URL shortener.
POST /shorten
: Shorten a long URL. Example request body:{ "original_url": "https://www.example.com" }
GET /:short_code
Redirect to Long URL