URL Shortener is a simple web application that shortens long URLs into more manageable and shareable short URLs. It's built using GoLang and uses Redis as the database for storing URL mappings.
- Shorten long URLs into short and manageable links.
- Custom short URL preference available.
- Rate limiting to prevent abuse.
- Expiry time for short URLs.
- Simple API endpoints for URL shortening and resolving.
- Docker (for running the application and Redis)
-
Clone this repository to your local machine:
git clone https://github.com/your-username/URL_Shortner.git cd URL_Shortner
-
Create a
.env
file in the api repo of the project with the following content:DB_ADDR="redis-db:6379" DB_PASS="" APP_PORT=":3000" DOMAIN="localhost:3000" API_QUOTA=10
Adjust the values as needed.
-
Build and run the application using Docker Compose:
docker-compose up
The application should now be up and running. You can access the API at http://localhost:3000.
- To shorten a URL, make a
POST
request to/shorten
with a JSON body containing the URL to be shortened. - To access a shortened URL, visit
http://localhost:3000/shortURL
whereshortURL
is the short code generated.
DB_ADDR
: Address of the Redis database.DB_PASS
: Password for the Redis database.APP_PORT
: Port on which the GoLang application will run.DOMAIN
: Domain used for generating short URLs.API_QUOTA
: Rate limit for API requests.
Contributions are welcome! Please feel free to fork this repository and submit pull requests to contribute to the project.
This project is licensed under the MIT License - see the LICENSE file for details.
Remember to replace placeholders like `your-username` with your actual GitHub username. You can customize the README further to include more detailed information about your project, such as additional features, use cases, and any other relevant details.