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

Shipped: Bookmark service

I built a Bookmark Service HTTP API designed with strict input boundary validation and idempotency handling. What was built: 1. Endpoints: - POST /bookmarks: Validates input and creates a bookmark, or returns the existing bookmark if repeated. - GET /bookmarks: Retrieves the list of all bookmarks. - GET /bookmarks/:id: Fetches a single bookmark by ID (returns 404 if not found). - DELETE /bookmarks/:id: Deletes a bookmark by ID (returns 204 or 404). 2. Input Validation (Survives Bad Input with 400 status): - Returns 400 Bad Request with an explicit error message naming the 'url' field for: * Missing 'url' field * Non-string values (e.g., numbers, booleans) * Empty strings or whitespace-only inputs * URLs exceeding 2 KB in length * Invalid URL format or protocols other than http/https - No bad input produces an unhandled 500 error. 3. Duplicate Recognition: - Compares canonical URL strings to identify duplicates. - Sending the same create request twice leaves only one row and returns the existing record with status 200 OK. How a reviewer can verify: - Send test POST requests with empty body, numbers, and strings over 2KB to verify 400 error responses naming the 'url' field. - Send identical valid POST requests twice to verify only one row exists and no duplicate is created. - Check the README.md in the repository for documentation on duplicate handling. Repository: https://github.com/roh155/Bookmark-Service-API Built for the Verified Backend Internship · an API that survives bad input
Add a comment
0/2000