JavaRush
AI Academy
new
Promotion
Learning
Courses
Tasks
Quizzes
Games
Help
Schedule of nudges
Internship
Community
Users
Forum
Chat
Articles
Activities
Reviews
Subscriptions
Light theme

Lectures

  • Reviews
  • About us
  • CS50
Start
Start learning
Start learning
  • My progress
  • Courses
  • Quest map
  • Lectures
  • POST create — decode JSON, validate, responses 201/400

    Go SELF
    61 level,0 lecture
    We break down the contract for creating a resource via POST /api/v1/tasks: how to decode JSON strictly and safely ( json.Decoder + DisallowUnknownFields() + body size limit), how to validate and normalize fields via a typed ValidationError, and how to produce a correct HTTP response: 201 Created with a Location header and a JSON body, or 400 Bad Request in a unified error envelope.
    Open
  • GET list: filters, sorting, and stable output

    Go SELF
    61 level,1 lecture
    We break down the list endpoint contract for GET /api/v1/tasks: why the response is better wrapped into an object { "tasks" : [...] }, how to correctly read query parameters via url.Values, validate done/ sort, filter without unnecessary allocations, and make the output deterministic: sorting by ID by default, and Title + tie-break by ID when sort=title. As a finale, we assemble the handler pipeline parse → list → filter → sort → encode on net/http.
    Open
  • Done endpoint — PATCH/POST semantics and 200/204 responses

    Go SELF
    61 level,2 lecture
    We break down how to design an endpoint for marking a task as done in a clean way: what to choose — PATCH or POST, how to ensure idempotency, why for success it is often better to return 204 No Content rather than 200, and how to implement it in Go 1.22+ using ServeMux and PathValue. At the end: common mistakes and how to avoid them.
    Open
  • DELETE: idempotency and 404 Not Found

    Go SELF
    61 level,3 lecture
    We break down why DELETE is not “just delete,” but a contract that matters for retries and automation: what idempotency is (the effect matters, not the response), which status to choose on success ( 204 No Content), and what to do if the resource does not exist ( 404 Not Found). We implement DELETE /api/v1/tasks/{id} the Go way: a single {id} parsing approach via parseID, a domain error ErrNotFound, and mapping via errors.Is plus a shared writeError.
    Open
  • Mapping errors to HTTP codes via a single error envelope

    Go SELF
    61 level,4 lecture
    We break down how to turn errors into part of the API contract: introduce a unified JSON error envelope, define error classes ( validation/ not_found/ internal), set up a centralized policy via mapError and writeError, and connect domain errors ( ErrNotFound, ValidationError) to statuses 400/ 404/ 500, avoiding internal detail leaks and using errors.Is/ errors.As.
    Open
Learn
  • Registration
  • Java course
  • Help with tasks
  • Pricing
Community
  • Users
  • Articles
  • Forum
  • Chat
  • Activities
Company
  • About us
  • Contacts
  • Reviews
  • FAQ
  • Support
JavaRushJavaRush — is an interactive online course for learning Java programming from scratch. It contains 1200 practical tasks with one-click solution checking, the necessary minimum of theory on Java basics, and motivating features that help you complete the course: games, quizzes, interesting projects and articles on effective learning and the career of a Java developer.
Follow us
Язык интерфейса
Русский
English
Українська
"Programmers are not born" © 2026 JavaRush
MastercardVisa
"Programmers are not born" © 2026 JavaRush