Skip to main content
You will build one POST /tasks endpoint. Invalid JSON stops at the contract boundary; accepted input reaches a typed handler.

Prerequisites

  • Go 1.27 or later
  • A Go module you can run locally

Install HTTPAPI

Define and serve the endpoint

Create main.go:

Run and call it

Start the service:
Send a request from another terminal:
The parser removes the surrounding spaces before the handler receives the value:
Try an empty name. The handler will not run; HTTPAPI returns a structured parameter error instead.

What to add next

  1. Replace the example map with a declared response shape.
  2. Add authorization, timeouts, limits, and operation metadata in the endpoint contract.
  3. Install your authentication and persistence adapters through server wiring.