📌 URL Shortener Backend (Go)
A simple url_shortener project build alone with Backend. The above project fails for industrial productions, it's just a attempt to test my Backend Skills. It Correctly gives Short URL on Local Server.
🚀 Features
✔️ Shorten long URLs ✔️ Redirect short URLs to original URLs ✔️ REST API endpoints ✔️ Minimal, clean Go backend architecture ✔️ Easy to deploy (Render, Railway, etc.) ✔️ Fast and lightweight — powered by Go
🛠️ Tech Stack
Golang net/http mux
📂 Project Structure . ├── go.mod # Go module file (module name, dependencies) └── main.go # Main application file containing: # - URL shortening endpoint (/shorten) # - Random key generator # - In-memory URL store # - Redirect handler for short URLs
📡 API Endpoints
POST /shorten
Body:
{ "url": "https://example.com" }
Response:
{ "short_url": "http://localhost:8080/abc123" }
🔁 Redirect to Original URL
GET /{shortCode}
Redirects the user to the original full-length URL.
📦 Installation & Run 1️⃣ Clone the repository git clone https://github.com/sainathmanda7/basic_urlshortner.git
2️⃣ Install dependencies go mod tidy
3️⃣ Run the server go run main.go
Server will run on: