This URL Shortener is a simple web service that provides short aliases for redirection of long URLs. It's built with Flask and uses Redis for storage.
- Create short URLs from long URLs
- Redirect from a short URL to the original URL
- Delete short URLs
- Python 3.6+
- Redis server
-
Clone the repository:
https://github.com/anoop-patil/URLShortner.git -
Install the required packages:
pip install -r requirements.txt -
Start the Redis server (refer to Redis documentation for specific instructions).
-
Run the application:
python url_shortner.py
curl -X POST http://localhost:8080/ -H "Content-Type: application/json" -d '{"url": "https://www.example.com"}'
curl http://localhost:8080/<short_key>
curl -X DELETE http://localhost:8080/<short_key>
Run tests using pytest:
pytest tests/
Of course, this was inspired by John Crickett's Coding Challenges - https://codingchallenges.fyi/challenges/challenge-url-shortener