A URL shortener service built with Go using the GIN framework, with storage options including MongoDB and Redis, and a frontend developed with HTML, CSS, and JavaScript.
- Shorten long URLs
- Redirect short URLs to the original URL
- Storage using either MongoDB or Redis
- Frontend using HTML, CSS, and JavaScript
- Go 1.22+
- MongoDB or Redis
git clone https://github.com/BrainAxe/url-shortener.git
cd url-shortenergo mod tidyCreate a .env file in the root directory with the following content:
MONGO_STORE_SOURCE=mongodb://localhost:27017
REDIS_STORE_SOURCE=localhost:6378
HOST_PORT=9000go run main.goThe application will start on http://localhost:9000.
- POST /api/shorten - Shorten a long URL
- GET /api/:shortUrl - Redirect to the original URL
The frontend, built with HTML, CSS, and JavaScript, is accessible at the root endpoint.
- Visit
http://localhost:9000to access the frontend interface.
This project is licensed under the MIT License. See LICENSE for more information.