0
showcase
Shipped: Short link service
Built a Short Link REST API using Python, FastAPI, SQLite, Pydantic, and Pytest.
Implemented features:
- Create short links and redirect visitors to their original URLs.
- Track visit counts and retrieve link statistics.
- Return HTTP 404 for unknown short codes.
- Validate malformed URLs and return HTTP 400 with field-specific error details before storing invalid data.
- Reject unexpected request fields.
- Reuse the existing short code when the same URL is submitted again, avoiding duplicate records.
- Persist links and visit counts in SQLite.
How to verify the acceptance criteria:
The repository includes a README with setup instructions and API examples, plus automated tests in
tests/test_main.py. All 6 tests pass, covering link creation, duplicate URL handling, invalid input without database storage, unknown codes, redirects and visit counting, and unexpected fields.
Run locally using the instructions in the README, then execute python -m pytest -v to verify the tests.
Repository: https://github.com/mradipatil770-cpu/short-link-service
Repository: https://github.com/mradipatil770-cpu/short-link-service
Built for the Verified Backend Internship · an API that survives bad inputAdd a comment
0/2000