Files
ushort/TASK-urlshortener.md
T
2026-03-17 15:45:46 +08:00

897 B

Task synopsis

I'd like to implement a URL shortener, mocking the de-facto urlshortener project, but with the following requirements:

Task requirements

  • We should implement it with python 3.8+, with minimum dependencies, in a single .py file. Using no 3rd party libraries/frameworks is the best.
  • The configs should be passed as a single JSON file, containing these keys:
    • base_url - the base URL to use for the shortened URLs
    • short_length - the length of the shortened URLs
    • api_key - the API key to use this shortener to create new shortened URLs
    • ... other configs, if you think are necessary, ask me.
  • The API should be RESTful, and simple enough to be used by a human.
  • The shortened data should be stored within a sqlite database.
  • Other than the .py file, provide a docker compose file to run it. Remember to keep the data in a mount dir so it won't be lost.