- Go 1.25 or later
- Redis (local installation)
-
Install Redis locally:
# macOS brew install redis # Start Redis brew services start redis # OR redis-server
-
Install Go dependencies:
go mod download
-
Set up environment variables: Edit
.envif needed (defaults should work for local Redis):APP_PORT: Port for the API server (default: 8080)DB_ADDR: Redis address (default: localhost:6379)DB_PASS: Redis password (leave empty for local Redis without password)
-
Run the application:
go run .The API will be available at
http://localhost:8080
POST /api/v1- Shorten a URLGET /api/v1/:shortID- Get original URL by short IDPUT /api/v1/:shortID- Edit a shortened URLDELETE /api/v1/:shortID- Delete a shortened URLPOST /api/v1/addTag- Add a tag to a URL