DevConnectDevConnect
Sign up · Log in
← back to the feed
0
showcase

Shipped: Short link service

What I built: A Flask + SQLite URL shortener with three endpoints: POST /links (create), GET /<code> (redirect + count visit), GET /links/<code>/stats (check URL + click count). All input is validated before it touches the database — bad requests get 400 with the exact field and rule that failed, never a 500. Short codes are a hash of the URL, so the same URL always maps to the same code, making creation idempotent. How a reviewer can verify it: Create/follow/count — POST /links → 200 + code; GET /<code> → 302 redirect; stats endpoint shows clicks going up each follow. 301 vs 302 — README explains why 302 was chosen (not cached, so clicks are counted reliably). Unknown code → 404 — confirmed by hitting a code that was never created. Malformed URL → 400, nothing stored — confirmed by posting an invalid URL and checking its stats never resolve. Duplicate URL → same code — confirmed by posting the same URL twice and comparing the two responses. All verifiable with the curl/PowerShell commands in the README. Repository link: https://github.com/hassannnn13/Shortlink-service.git Repository: https://github.com/hassannnn13/Shortlink-service.git Built for the Verified Backend Internship · an API that survives bad input
Add a comment
0/2000