[{"data":1,"prerenderedAt":2012},["ShallowReactive",2],{"navigation_docs":3,"-backend-development-http-api-design":377,"-backend-development-http-api-design-surround":2007},[4,39,114,144,184,244,293,362],{"title":5,"icon":6,"path":7,"stem":8,"children":9,"page":6},"Getting Started",false,"\u002Fgetting-started","1.getting-started",[10,15,20,25,30,35],{"title":11,"path":12,"stem":13,"icon":14},"Learning Path","\u002Fgetting-started\u002Flearning-path","1.getting-started\u002F1.learning-path","i-lucide-map",{"title":16,"path":17,"stem":18,"icon":19},"Introduction","\u002Fgetting-started\u002Fintroduction","1.getting-started\u002F2.introduction","i-lucide-house",{"title":21,"path":22,"stem":23,"icon":24},"Installation","\u002Fgetting-started\u002Finstallation","1.getting-started\u002F3.installation","i-lucide-download",{"title":26,"path":27,"stem":28,"icon":29},"Your First Program","\u002Fgetting-started\u002Ffirst-program","1.getting-started\u002F4.first-program","i-lucide-play",{"title":31,"path":32,"stem":33,"icon":34},"Modules and Dependencies","\u002Fgetting-started\u002Fmodules-and-dependencies","1.getting-started\u002F5.modules-and-dependencies","i-lucide-package-open",{"title":36,"path":37,"stem":38,"icon":34},"Advanced Modules","\u002Fgetting-started\u002Fadvanced-modules","1.getting-started\u002F6.advanced-modules",{"title":40,"path":41,"stem":42,"children":43,"page":6},"Fundamentals","\u002Ffundamentals","2.fundamentals",[44,49,54,59,64,69,74,79,84,89,94,99,104,109],{"title":45,"path":46,"stem":47,"icon":48},"Program Structure","\u002Ffundamentals\u002Fprogram-structure","2.fundamentals\u002F1.program-structure","i-lucide-workflow",{"title":50,"path":51,"stem":52,"icon":53},"Structs and Methods","\u002Ffundamentals\u002Fstructs-and-methods","2.fundamentals\u002F10.structs-and-methods","i-lucide-box",{"title":55,"path":56,"stem":57,"icon":58},"Interfaces","\u002Ffundamentals\u002Finterfaces","2.fundamentals\u002F11.interfaces","i-lucide-plug",{"title":60,"path":61,"stem":62,"icon":63},"Error Handling","\u002Ffundamentals\u002Ferrors","2.fundamentals\u002F12.errors","i-lucide-triangle-alert",{"title":65,"path":66,"stem":67,"icon":68},"Defined Types and Type Aliases","\u002Ffundamentals\u002Fdefined-types","2.fundamentals\u002F13.defined-types","i-lucide-tags",{"title":70,"path":71,"stem":72,"icon":73},"Generics","\u002Ffundamentals\u002Fgenerics","2.fundamentals\u002F14.generics","i-lucide-blocks",{"title":75,"path":76,"stem":77,"icon":78},"Project Structure","\u002Ffundamentals\u002Fproject-structure","2.fundamentals\u002F2.project-structure","i-lucide-folder-tree",{"title":80,"path":81,"stem":82,"icon":83},"Project Layout","\u002Ffundamentals\u002Fproject-layout","2.fundamentals\u002F3.project-layout","i-lucide-layout",{"title":85,"path":86,"stem":87,"icon":88},"Variables and Data Types","\u002Ffundamentals\u002Fvariables-and-types","2.fundamentals\u002F4.variables-and-types","i-lucide-variable",{"title":90,"path":91,"stem":92,"icon":93},"Functions","\u002Ffundamentals\u002Ffunctions","2.fundamentals\u002F5.functions","i-lucide-braces",{"title":95,"path":96,"stem":97,"icon":98},"Control Statements","\u002Ffundamentals\u002Fcontrol-statements","2.fundamentals\u002F6.control-statements","i-lucide-git-branch",{"title":100,"path":101,"stem":102,"icon":103},"Pointers","\u002Ffundamentals\u002Fpointers","2.fundamentals\u002F7.pointers","i-lucide-mouse-pointer-2",{"title":105,"path":106,"stem":107,"icon":108},"Arrays and Slices","\u002Ffundamentals\u002Farrays-and-slices","2.fundamentals\u002F8.arrays-and-slices","i-lucide-list",{"title":110,"path":111,"stem":112,"icon":113},"Maps","\u002Ffundamentals\u002Fmaps","2.fundamentals\u002F9.maps","i-lucide-table-properties",{"title":115,"path":116,"stem":117,"children":118,"page":6},"Concurrency","\u002Fconcurrency","3.concurrency",[119,124,129,134,139],{"title":120,"path":121,"stem":122,"icon":123},"Concurrency Model","\u002Fconcurrency\u002Fconcurrency-model","3.concurrency\u002F1.concurrency-model","i-lucide-network",{"title":125,"path":126,"stem":127,"icon":128},"Goroutines","\u002Fconcurrency\u002Fgoroutines","3.concurrency\u002F2.goroutines","i-lucide-git-fork",{"title":130,"path":131,"stem":132,"icon":133},"Channels","\u002Fconcurrency\u002Fchannels","3.concurrency\u002F3.channels","i-lucide-arrow-left-right",{"title":135,"path":136,"stem":137,"icon":138},"Select and Cancellation","\u002Fconcurrency\u002Fselect-and-cancellation","3.concurrency\u002F4.select-and-cancellation","i-lucide-circle-stop",{"title":140,"path":141,"stem":142,"icon":143},"Synchronization","\u002Fconcurrency\u002Fsynchronization","3.concurrency\u002F5.synchronization","i-lucide-lock-keyhole",{"title":145,"path":146,"stem":147,"children":148,"page":6},"Standard Library","\u002Fstandard-library","4.standard-library",[149,154,159,164,169,174,179],{"title":150,"path":151,"stem":152,"icon":153},"Standard Library Overview","\u002Fstandard-library\u002Foverview","4.standard-library\u002F1.overview","i-lucide-library",{"title":155,"path":156,"stem":157,"icon":158},"Text and Formatting","\u002Fstandard-library\u002Ftext-and-formatting","4.standard-library\u002F2.text-and-formatting","i-lucide-text",{"title":160,"path":161,"stem":162,"icon":163},"Files and JSON","\u002Fstandard-library\u002Ffiles-and-json","4.standard-library\u002F3.files-and-json","i-lucide-file-json",{"title":165,"path":166,"stem":167,"icon":168},"HTTP Clients and Servers","\u002Fstandard-library\u002Fhttp","4.standard-library\u002F4.http","i-lucide-server",{"title":170,"path":171,"stem":172,"icon":173},"Testing","\u002Fstandard-library\u002Ftesting","4.standard-library\u002F5.testing","i-lucide-flask-conical",{"title":175,"path":176,"stem":177,"icon":178},"Command-Line Tools and Configuration","\u002Fstandard-library\u002Fcommand-line-and-configuration","4.standard-library\u002F6.command-line-and-configuration","i-lucide-terminal-square",{"title":180,"path":181,"stem":182,"icon":183},"Structured Logging","\u002Fstandard-library\u002Fstructured-logging","4.standard-library\u002F7.structured-logging","i-lucide-scroll-text",{"title":185,"path":186,"stem":187,"children":188,"page":6},"Backend Development","\u002Fbackend-development","5.backend-development",[189,194,199,204,209,214,219,224,229,234,239],{"title":190,"path":191,"stem":192,"icon":193},"Backend Roadmap","\u002Fbackend-development\u002Fbackend-roadmap","5.backend-development\u002F1.backend-roadmap","i-lucide-route",{"title":195,"path":196,"stem":197,"icon":198},"Graceful Shutdown","\u002Fbackend-development\u002Fgraceful-shutdown","5.backend-development\u002F10.graceful-shutdown","i-lucide-power",{"title":200,"path":201,"stem":202,"icon":203},"Production Checklist","\u002Fbackend-development\u002Fproduction-checklist","5.backend-development\u002F11.production-checklist","i-lucide-clipboard-check",{"title":205,"path":206,"stem":207,"icon":208},"HTTP API Design","\u002Fbackend-development\u002Fhttp-api-design","5.backend-development\u002F2.http-api-design","i-lucide-waypoints",{"title":210,"path":211,"stem":212,"icon":213},"Middleware","\u002Fbackend-development\u002Fmiddleware","5.backend-development\u002F3.middleware","i-lucide-layers-3",{"title":215,"path":216,"stem":217,"icon":218},"Validation","\u002Fbackend-development\u002Fvalidation","5.backend-development\u002F4.validation","i-lucide-list-checks",{"title":220,"path":221,"stem":222,"icon":223},"Application Wiring","\u002Fbackend-development\u002Fapplication-wiring","5.backend-development\u002F5.application-wiring","i-lucide-cable",{"title":225,"path":226,"stem":227,"icon":228},"Observability","\u002Fbackend-development\u002Fobservability","5.backend-development\u002F6.observability","i-lucide-activity",{"title":230,"path":231,"stem":232,"icon":233},"Database SQL","\u002Fbackend-development\u002Fdatabase-sql","5.backend-development\u002F7.database-sql","i-lucide-database",{"title":235,"path":236,"stem":237,"icon":238},"Transactions","\u002Fbackend-development\u002Ftransactions","5.backend-development\u002F8.transactions","i-lucide-repeat-2",{"title":240,"path":241,"stem":242,"icon":243},"Authentication and Authorization","\u002Fbackend-development\u002Fauthentication","5.backend-development\u002F9.authentication","i-lucide-shield-check",{"title":245,"path":246,"stem":247,"children":248,"page":6},"Advanced Go","\u002Fadvanced-go","6.advanced-go",[249,254,259,264,269,274,278,283,288],{"title":250,"path":251,"stem":252,"icon":253},"Advanced Go Roadmap","\u002Fadvanced-go\u002Fadvanced-roadmap","6.advanced-go\u002F1.advanced-roadmap","i-lucide-brain-circuit",{"title":255,"path":256,"stem":257,"icon":258},"Reflection","\u002Fadvanced-go\u002Freflection","6.advanced-go\u002F2.reflection","i-lucide-scan-search",{"title":260,"path":261,"stem":262,"icon":263},"Memory and Garbage Collection","\u002Fadvanced-go\u002Fmemory-and-garbage-collection","6.advanced-go\u002F3.memory-and-garbage-collection","i-lucide-memory-stick",{"title":265,"path":266,"stem":267,"icon":268},"Benchmarking and Profiling","\u002Fadvanced-go\u002Fbenchmarking-and-profiling","6.advanced-go\u002F4.benchmarking-and-profiling","i-lucide-gauge",{"title":270,"path":271,"stem":272,"icon":273},"Advanced Testing and Fuzzing","\u002Fadvanced-go\u002Fadvanced-testing-and-fuzzing","6.advanced-go\u002F5.advanced-testing-and-fuzzing","i-lucide-microscope",{"title":275,"path":276,"stem":277,"icon":48},"Advanced Concurrency","\u002Fadvanced-go\u002Fadvanced-concurrency","6.advanced-go\u002F6.advanced-concurrency",{"title":279,"path":280,"stem":281,"icon":282},"Unsafe and C Boundaries","\u002Fadvanced-go\u002Funsafe-and-cgo","6.advanced-go\u002F7.unsafe-and-cgo","i-lucide-radiation",{"title":284,"path":285,"stem":286,"icon":287},"Package and API Design","\u002Fadvanced-go\u002Fpackage-and-api-design","6.advanced-go\u002F8.package-and-api-design","i-lucide-boxes",{"title":289,"path":290,"stem":291,"icon":292},"Distributed Reliability","\u002Fadvanced-go\u002Fdistributed-reliability","6.advanced-go\u002F9.distributed-reliability","i-lucide-cloud-cog",{"title":294,"path":295,"stem":296,"children":297,"page":6},"Projects","\u002Fprojects","7.projects",[298,316,332,347],{"title":299,"path":300,"stem":301,"children":302,"icon":305},"CLI Task Manager","\u002Fprojects\u002Fcli-task-manager","7.projects\u002F1.cli-task-manager\u002Findex",[303,306,311],{"title":304,"path":300,"stem":301,"icon":305},"Project — CLI Task Manager","i-lucide-list-todo",{"title":307,"path":308,"stem":309,"icon":310},"CLI — Domain and Storage","\u002Fprojects\u002Fcli-task-manager\u002Fdomain-and-storage","7.projects\u002F1.cli-task-manager\u002F1.domain-and-storage","i-lucide-save",{"title":312,"path":313,"stem":314,"icon":315},"CLI — Commands and Tests","\u002Fprojects\u002Fcli-task-manager\u002Fcommands-and-tests","7.projects\u002F1.cli-task-manager\u002F2.commands-and-tests","i-lucide-terminal",{"title":317,"path":318,"stem":319,"children":320,"icon":323},"Concurrent URL Checker","\u002Fprojects\u002Fconcurrent-url-checker","7.projects\u002F2.concurrent-url-checker\u002Findex",[321,324,328],{"title":322,"path":318,"stem":319,"icon":323},"Project — Concurrent URL Checker","i-lucide-radar",{"title":325,"path":326,"stem":327,"icon":128},"URL Checker — Worker Pipeline","\u002Fprojects\u002Fconcurrent-url-checker\u002Fworker-pipeline","7.projects\u002F2.concurrent-url-checker\u002F1.worker-pipeline",{"title":329,"path":330,"stem":331,"icon":173},"URL Checker — Cancellation and Tests","\u002Fprojects\u002Fconcurrent-url-checker\u002Fcancellation-and-tests","7.projects\u002F2.concurrent-url-checker\u002F2.cancellation-and-tests",{"title":333,"path":334,"stem":335,"children":336},"File-backed API","\u002Fprojects\u002Ffile-backed-api","7.projects\u002F3.file-backed-api\u002Findex",[337,339,343],{"title":338,"path":334,"stem":335},"File-backed notes API",{"title":340,"path":341,"stem":342},"File store and concurrency","\u002Fprojects\u002Ffile-backed-api\u002Ffile-store-and-concurrency","7.projects\u002F3.file-backed-api\u002F1.file-store-and-concurrency",{"title":344,"path":345,"stem":346},"HTTP layer and tests","\u002Fprojects\u002Ffile-backed-api\u002Fhttp-and-tests","7.projects\u002F3.file-backed-api\u002F2.http-and-tests",{"title":348,"path":349,"stem":350,"children":351},"Production REST API","\u002Fprojects\u002Fproduction-rest-api","7.projects\u002F4.production-rest-api\u002Findex",[352,354,358],{"title":353,"path":349,"stem":350},"Production REST API capstone",{"title":355,"path":356,"stem":357},"Persistence and authentication","\u002Fprojects\u002Fproduction-rest-api\u002Fpersistence-and-auth","7.projects\u002F4.production-rest-api\u002F1.persistence-and-auth",{"title":359,"path":360,"stem":361},"Operations and release","\u002Fprojects\u002Fproduction-rest-api\u002Foperations-and-release","7.projects\u002F4.production-rest-api\u002F2.operations-and-release",{"title":363,"path":364,"stem":365,"children":366,"page":6},"Meta","\u002Fmeta","99.meta",[367,372],{"title":368,"path":369,"stem":370,"icon":371},"About","\u002Fmeta\u002Fabout","99.meta\u002F1.about","i-lucide-info",{"title":373,"path":374,"stem":375,"icon":376},"Acknowledgements","\u002Fmeta\u002Facknowledgements","99.meta\u002F2.acknowledgements","i-lucide-heart-handshake",{"id":378,"title":205,"body":379,"description":1999,"extension":2000,"links":2001,"meta":2002,"navigation":2003,"path":206,"seo":2004,"stem":207,"__hash__":2006},"docs\u002F5.backend-development\u002F2.http-api-design.md",{"type":380,"value":381,"toc":1983},"minimark",[382,388,393,397,416,420,423,426,430,441,444,448,480,483,487,619,622,626,961,964,968,1096,1099,1102,1108,1112,1188,1202,1205,1209,1349,1352,1356,1359,1362,1366,1383,1387,1428,1432,1447,1952,1956,1973,1976,1979],[383,384],"learning-lesson-meta",{"level":385,"prerequisites":386,"time":387},"Intermediate","net\u002Fhttp, JSON, errors, and testing","50–65 minutes",[389,390,392],"h2",{"id":391},"what-you-will-learn","What you will learn",[394,395,396],"p",{},"By the end of this lesson, you will be able to:",[398,399,400,404,407,410,413],"ul",{},[401,402,403],"li",{},"design resource-oriented routes and choose appropriate methods;",[401,405,406],{},"separate request, domain, and response types;",[401,408,409],{},"return consistent status codes and error bodies;",[401,411,412],{},"reason about idempotency, pagination, and API evolution;",[401,414,415],{},"test the observable HTTP contract.",[389,417,419],{"id":418},"mental-model-the-api-is-a-contract","Mental model: the API is a contract",[394,421,422],{},"Clients depend on paths, methods, status codes, headers, and JSON shapes. Once published, accidental changes can break software you do not control.",[394,424,425],{},"Design the contract before optimising handler code.",[389,427,429],{"id":428},"model-resources-with-nouns","Model resources with nouns",[431,432,438],"pre",{"className":433,"code":435,"language":436,"meta":437},[434],"language-text","GET    \u002Flessons          list lessons\nPOST   \u002Flessons          create a lesson\nGET    \u002Flessons\u002F{id}     retrieve one lesson\nPATCH  \u002Flessons\u002F{id}     partially update a lesson\nDELETE \u002Flessons\u002F{id}     delete a lesson\n","text","",[439,440,435],"code",{"__ignoreMap":437},[394,442,443],{},"Use action endpoints only when the operation does not map clearly to resource state, and name them deliberately.",[389,445,447],{"id":446},"method-semantics","Method semantics",[398,449,450,456,462,468,474],{},[401,451,452,455],{},[439,453,454],{},"GET"," reads and should not change application state.",[401,457,458,461],{},[439,459,460],{},"POST"," commonly creates or starts a non-idempotent operation.",[401,463,464,467],{},[439,465,466],{},"PUT"," replaces a resource representation and is intended to be idempotent.",[401,469,470,473],{},[439,471,472],{},"PATCH"," applies a partial change; whether repeated application is safe depends on the patch design.",[401,475,476,479],{},[439,477,478],{},"DELETE"," removes a resource and is intended to be idempotent from the client's desired-state perspective.",[394,481,482],{},"Idempotent means repeating the same request has the same intended effect, not necessarily the same response or internal side effects.",[389,484,486],{"id":485},"separate-transport-and-domain-types","Separate transport and domain types",[431,488,492],{"className":489,"code":490,"language":491,"meta":437,"style":437},"language-go shiki shiki-themes solarized-light material-theme one-dark-pro","type createLessonRequest struct {\n    Title string `json:\"title\"`\n}\n\ntype lessonResponse struct {\n    ID        string    `json:\"id\"`\n    Title     string    `json:\"title\"`\n    CreatedAt time.Time `json:\"created_at\"`\n}\n","go",[439,493,494,514,536,542,549,561,578,592,614],{"__ignoreMap":437},[495,496,499,503,507,510],"span",{"class":497,"line":498},"line",1,[495,500,502],{"class":501},"sEOdo","type",[495,504,506],{"class":505},"snwKR"," createLessonRequest",[495,508,509],{"class":501}," struct",[495,511,513],{"class":512},"shFME"," {\n",[495,515,517,521,525,529,533],{"class":497,"line":516},2,[495,518,520],{"class":519},"s45-6","    Title",[495,522,524],{"class":523},"sF6sA"," string",[495,526,528],{"class":527},"sED5a"," `",[495,530,532],{"class":531},"sVazx","json:\"title\"",[495,534,535],{"class":527},"`\n",[495,537,539],{"class":497,"line":538},3,[495,540,541],{"class":512},"}\n",[495,543,545],{"class":497,"line":544},4,[495,546,548],{"emptyLinePlaceholder":547},true,"\n",[495,550,552,554,557,559],{"class":497,"line":551},5,[495,553,502],{"class":501},[495,555,556],{"class":505}," lessonResponse",[495,558,509],{"class":501},[495,560,513],{"class":512},[495,562,564,567,570,573,576],{"class":497,"line":563},6,[495,565,566],{"class":519},"    ID",[495,568,569],{"class":523},"        string",[495,571,572],{"class":527},"    `",[495,574,575],{"class":531},"json:\"id\"",[495,577,535],{"class":527},[495,579,581,583,586,588,590],{"class":497,"line":580},7,[495,582,520],{"class":519},[495,584,585],{"class":523},"     string",[495,587,572],{"class":527},[495,589,532],{"class":531},[495,591,535],{"class":527},[495,593,595,598,601,604,607,609,612],{"class":497,"line":594},8,[495,596,597],{"class":519},"    CreatedAt",[495,599,600],{"class":505}," time",[495,602,603],{"class":512},".",[495,605,606],{"class":505},"Time",[495,608,528],{"class":527},[495,610,611],{"class":531},"json:\"created_at\"",[495,613,535],{"class":527},[495,615,617],{"class":497,"line":616},9,[495,618,541],{"class":512},[394,620,621],{},"Do not expose database models automatically. Request types express what clients may send; response types express the public contract; domain types express business meaning.",[389,623,625],{"id":624},"decode-one-bounded-json-value","Decode one bounded JSON value",[431,627,629],{"className":489,"code":628,"language":491,"meta":437,"style":437},"func decodeJSON(w http.ResponseWriter, r *http.Request, dst any) error {\n    r.Body = http.MaxBytesReader(w, r.Body, 1\u003C\u003C20)\n\n    decoder := json.NewDecoder(r.Body)\n    decoder.DisallowUnknownFields()\n\n    if err := decoder.Decode(dst); err != nil {\n        return fmt.Errorf(\"decode JSON: %w\", err)\n    }\n\n    if err := decoder.Decode(&struct{}{}); !errors.Is(err, io.EOF) {\n        return errors.New(\"request body must contain one JSON value\")\n    }\n    return nil\n}\n",[439,630,631,688,737,741,768,780,784,822,855,860,865,918,942,947,956],{"__ignoreMap":437},[495,632,633,636,640,643,647,650,652,655,658,661,664,667,669,672,674,677,680,683,686],{"class":497,"line":498},[495,634,635],{"class":501},"func",[495,637,639],{"class":638},"sisdC"," decodeJSON",[495,641,642],{"class":512},"(",[495,644,646],{"class":645},"syre3","w",[495,648,649],{"class":505}," http",[495,651,603],{"class":512},[495,653,654],{"class":505},"ResponseWriter",[495,656,657],{"class":512},",",[495,659,660],{"class":645}," r",[495,662,663],{"class":501}," *",[495,665,666],{"class":505},"http",[495,668,603],{"class":512},[495,670,671],{"class":505},"Request",[495,673,657],{"class":512},[495,675,676],{"class":645}," dst",[495,678,679],{"class":505}," any",[495,681,682],{"class":512},")",[495,684,685],{"class":523}," error",[495,687,513],{"class":512},[495,689,690,693,695,698,702,704,706,709,711,713,715,717,719,721,723,727,731,734],{"class":497,"line":516},[495,691,692],{"class":519},"    r",[495,694,603],{"class":512},[495,696,697],{"class":519},"Body",[495,699,701],{"class":700},"su2KV"," =",[495,703,649],{"class":519},[495,705,603],{"class":512},[495,707,708],{"class":638},"MaxBytesReader",[495,710,642],{"class":512},[495,712,646],{"class":519},[495,714,657],{"class":512},[495,716,660],{"class":519},[495,718,603],{"class":512},[495,720,697],{"class":519},[495,722,657],{"class":512},[495,724,726],{"class":725},"sAJzr"," 1",[495,728,730],{"class":729},"sRBoR","\u003C\u003C",[495,732,733],{"class":725},"20",[495,735,736],{"class":512},")\n",[495,738,739],{"class":497,"line":538},[495,740,548],{"emptyLinePlaceholder":547},[495,742,743,746,749,752,754,757,759,762,764,766],{"class":497,"line":544},[495,744,745],{"class":519},"    decoder",[495,747,748],{"class":700}," :=",[495,750,751],{"class":519}," json",[495,753,603],{"class":512},[495,755,756],{"class":638},"NewDecoder",[495,758,642],{"class":512},[495,760,761],{"class":519},"r",[495,763,603],{"class":512},[495,765,697],{"class":519},[495,767,736],{"class":512},[495,769,770,772,774,777],{"class":497,"line":551},[495,771,745],{"class":519},[495,773,603],{"class":512},[495,775,776],{"class":638},"DisallowUnknownFields",[495,778,779],{"class":512},"()\n",[495,781,782],{"class":497,"line":563},[495,783,548],{"emptyLinePlaceholder":547},[495,785,786,790,793,795,798,800,803,805,808,811,813,816,820],{"class":497,"line":580},[495,787,789],{"class":788},"s7Bcg","    if",[495,791,792],{"class":519}," err",[495,794,748],{"class":700},[495,796,797],{"class":519}," decoder",[495,799,603],{"class":512},[495,801,802],{"class":638},"Decode",[495,804,642],{"class":512},[495,806,807],{"class":519},"dst",[495,809,810],{"class":512},");",[495,812,792],{"class":519},[495,814,815],{"class":729}," !=",[495,817,819],{"class":818},"sp8Z5"," nil",[495,821,513],{"class":512},[495,823,824,827,830,832,835,837,840,843,847,849,851,853],{"class":497,"line":594},[495,825,826],{"class":788},"        return",[495,828,829],{"class":519}," fmt",[495,831,603],{"class":512},[495,833,834],{"class":638},"Errorf",[495,836,642],{"class":512},[495,838,839],{"class":527},"\"",[495,841,842],{"class":531},"decode JSON: ",[495,844,846],{"class":845},"st3jj","%w",[495,848,839],{"class":527},[495,850,657],{"class":512},[495,852,792],{"class":519},[495,854,736],{"class":512},[495,856,857],{"class":497,"line":616},[495,858,859],{"class":512},"    }\n",[495,861,863],{"class":497,"line":862},10,[495,864,548],{"emptyLinePlaceholder":547},[495,866,868,870,872,874,876,878,880,882,885,888,891,894,896,899,901,904,906,909,911,914,916],{"class":497,"line":867},11,[495,869,789],{"class":788},[495,871,792],{"class":519},[495,873,748],{"class":700},[495,875,797],{"class":519},[495,877,603],{"class":512},[495,879,802],{"class":638},[495,881,642],{"class":512},[495,883,884],{"class":501},"&struct",[495,886,887],{"class":512},"{}{});",[495,889,890],{"class":729}," !",[495,892,893],{"class":519},"errors",[495,895,603],{"class":512},[495,897,898],{"class":638},"Is",[495,900,642],{"class":512},[495,902,903],{"class":519},"err",[495,905,657],{"class":512},[495,907,908],{"class":519}," io",[495,910,603],{"class":512},[495,912,913],{"class":519},"EOF",[495,915,682],{"class":512},[495,917,513],{"class":512},[495,919,921,923,926,928,931,933,935,938,940],{"class":497,"line":920},12,[495,922,826],{"class":788},[495,924,925],{"class":519}," errors",[495,927,603],{"class":512},[495,929,930],{"class":638},"New",[495,932,642],{"class":512},[495,934,839],{"class":527},[495,936,937],{"class":531},"request body must contain one JSON value",[495,939,839],{"class":527},[495,941,736],{"class":512},[495,943,945],{"class":497,"line":944},13,[495,946,859],{"class":512},[495,948,950,953],{"class":497,"line":949},14,[495,951,952],{"class":788},"    return",[495,954,955],{"class":818}," nil\n",[495,957,959],{"class":497,"line":958},15,[495,960,541],{"class":512},[394,962,963],{},"The second decode rejects extra JSON values. Decide whether unknown fields should be rejected or ignored, then keep that policy consistent.",[389,965,967],{"id":966},"write-responses-consistently","Write responses consistently",[431,969,971],{"className":489,"code":970,"language":491,"meta":437,"style":437},"func writeJSON(w http.ResponseWriter, status int, value any) error {\n    w.Header().Set(\"Content-Type\", \"application\u002Fjson\")\n    w.WriteHeader(status)\n    return json.NewEncoder(w).Encode(value)\n}\n",[439,972,973,1011,1048,1064,1092],{"__ignoreMap":437},[495,974,975,977,980,982,984,986,988,990,992,995,998,1000,1003,1005,1007,1009],{"class":497,"line":498},[495,976,635],{"class":501},[495,978,979],{"class":638}," writeJSON",[495,981,642],{"class":512},[495,983,646],{"class":645},[495,985,649],{"class":505},[495,987,603],{"class":512},[495,989,654],{"class":505},[495,991,657],{"class":512},[495,993,994],{"class":645}," status",[495,996,997],{"class":523}," int",[495,999,657],{"class":512},[495,1001,1002],{"class":645}," value",[495,1004,679],{"class":505},[495,1006,682],{"class":512},[495,1008,685],{"class":523},[495,1010,513],{"class":512},[495,1012,1013,1016,1018,1021,1024,1027,1029,1031,1034,1036,1038,1041,1044,1046],{"class":497,"line":516},[495,1014,1015],{"class":519},"    w",[495,1017,603],{"class":512},[495,1019,1020],{"class":638},"Header",[495,1022,1023],{"class":512},"().",[495,1025,1026],{"class":638},"Set",[495,1028,642],{"class":512},[495,1030,839],{"class":527},[495,1032,1033],{"class":531},"Content-Type",[495,1035,839],{"class":527},[495,1037,657],{"class":512},[495,1039,1040],{"class":527}," \"",[495,1042,1043],{"class":531},"application\u002Fjson",[495,1045,839],{"class":527},[495,1047,736],{"class":512},[495,1049,1050,1052,1054,1057,1059,1062],{"class":497,"line":538},[495,1051,1015],{"class":519},[495,1053,603],{"class":512},[495,1055,1056],{"class":638},"WriteHeader",[495,1058,642],{"class":512},[495,1060,1061],{"class":519},"status",[495,1063,736],{"class":512},[495,1065,1066,1068,1070,1072,1075,1077,1079,1082,1085,1087,1090],{"class":497,"line":544},[495,1067,952],{"class":788},[495,1069,751],{"class":519},[495,1071,603],{"class":512},[495,1073,1074],{"class":638},"NewEncoder",[495,1076,642],{"class":512},[495,1078,646],{"class":519},[495,1080,1081],{"class":512},").",[495,1083,1084],{"class":638},"Encode",[495,1086,642],{"class":512},[495,1088,1089],{"class":519},"value",[495,1091,736],{"class":512},[495,1093,1094],{"class":497,"line":551},[495,1095,541],{"class":512},[394,1097,1098],{},"For high-assurance code, encode into a buffer before sending headers if an encoding failure must still produce a controlled error response.",[394,1100,1101],{},"Useful creation response:",[431,1103,1106],{"className":1104,"code":1105,"language":436,"meta":437},[434],"HTTP\u002F1.1 201 Created\nLocation: \u002Flessons\u002Flesson-42\nContent-Type: application\u002Fjson\n",[439,1107,1105],{"__ignoreMap":437},[389,1109,1111],{"id":1110},"stable-error-shape","Stable error shape",[431,1113,1115],{"className":489,"code":1114,"language":491,"meta":437,"style":437},"type errorResponse struct {\n    Code    string         `json:\"code\"`\n    Message string         `json:\"message\"`\n    Fields  map[string]string `json:\"fields,omitempty\"`\n}\n",[439,1116,1117,1128,1144,1158,1184],{"__ignoreMap":437},[495,1118,1119,1121,1124,1126],{"class":497,"line":498},[495,1120,502],{"class":501},[495,1122,1123],{"class":505}," errorResponse",[495,1125,509],{"class":501},[495,1127,513],{"class":512},[495,1129,1130,1133,1136,1139,1142],{"class":497,"line":516},[495,1131,1132],{"class":519},"    Code",[495,1134,1135],{"class":523},"    string",[495,1137,1138],{"class":527},"         `",[495,1140,1141],{"class":531},"json:\"code\"",[495,1143,535],{"class":527},[495,1145,1146,1149,1151,1153,1156],{"class":497,"line":538},[495,1147,1148],{"class":519},"    Message",[495,1150,524],{"class":523},[495,1152,1138],{"class":527},[495,1154,1155],{"class":531},"json:\"message\"",[495,1157,535],{"class":527},[495,1159,1160,1163,1166,1169,1172,1175,1177,1179,1182],{"class":497,"line":544},[495,1161,1162],{"class":519},"    Fields",[495,1164,1165],{"class":501},"  map",[495,1167,1168],{"class":512},"[",[495,1170,1171],{"class":523},"string",[495,1173,1174],{"class":512},"]",[495,1176,1171],{"class":523},[495,1178,528],{"class":527},[495,1180,1181],{"class":531},"json:\"fields,omitempty\"",[495,1183,535],{"class":527},[495,1185,1186],{"class":497,"line":551},[495,1187,541],{"class":512},[394,1189,1190,1193,1194,1197,1198,1201],{},[439,1191,1192],{},"Code"," is stable for program logic. ",[439,1195,1196],{},"Message"," is safe text for people. ",[439,1199,1200],{},"Fields"," can describe validation failures.",[394,1203,1204],{},"Never return stack traces, SQL messages, filesystem paths, tokens, or raw internal errors to a client.",[389,1206,1208],{"id":1207},"status-code-guide","Status-code guide",[1210,1211,1212,1225],"table",{},[1213,1214,1215],"thead",{},[1216,1217,1218,1222],"tr",{},[1219,1220,1221],"th",{},"Situation",[1219,1223,1224],{},"Status",[1226,1227,1228,1239,1249,1259,1269,1279,1289,1299,1309,1319,1329,1339],"tbody",{},[1216,1229,1230,1234],{},[1231,1232,1233],"td",{},"Successful read or update",[1231,1235,1236],{},[439,1237,1238],{},"200 OK",[1216,1240,1241,1244],{},[1231,1242,1243],{},"Successful creation",[1231,1245,1246],{},[439,1247,1248],{},"201 Created",[1216,1250,1251,1254],{},[1231,1252,1253],{},"Successful action with no body",[1231,1255,1256],{},[439,1257,1258],{},"204 No Content",[1216,1260,1261,1264],{},[1231,1262,1263],{},"Malformed request",[1231,1265,1266],{},[439,1267,1268],{},"400 Bad Request",[1216,1270,1271,1274],{},[1231,1272,1273],{},"Missing or invalid credentials",[1231,1275,1276],{},[439,1277,1278],{},"401 Unauthorized",[1216,1280,1281,1284],{},[1231,1282,1283],{},"Authenticated but not permitted",[1231,1285,1286],{},[439,1287,1288],{},"403 Forbidden",[1216,1290,1291,1294],{},[1231,1292,1293],{},"Resource absent",[1231,1295,1296],{},[439,1297,1298],{},"404 Not Found",[1216,1300,1301,1304],{},[1231,1302,1303],{},"State conflict or duplicate",[1231,1305,1306],{},[439,1307,1308],{},"409 Conflict",[1216,1310,1311,1314],{},[1231,1312,1313],{},"Valid media type but validation failed",[1231,1315,1316],{},[439,1317,1318],{},"422 Unprocessable Entity",[1216,1320,1321,1324],{},[1231,1322,1323],{},"Unsupported media type",[1231,1325,1326],{},[439,1327,1328],{},"415 Unsupported Media Type",[1216,1330,1331,1334],{},[1231,1332,1333],{},"Rate limit exceeded",[1231,1335,1336],{},[439,1337,1338],{},"429 Too Many Requests",[1216,1340,1341,1344],{},[1231,1342,1343],{},"Unexpected server failure",[1231,1345,1346],{},[439,1347,1348],{},"500 Internal Server Error",[394,1350,1351],{},"Teams differ on some client-error choices. Consistency and clear documentation matter more than arguing over one reasonable mapping.",[389,1353,1355],{"id":1354},"pagination","Pagination",[394,1357,1358],{},"Do not return an unbounded collection. Offset pagination is easy to understand but can become slow or inconsistent for frequently changing large data sets. Cursor pagination can provide stable traversal but requires a well-defined ordering and opaque cursor handling.",[394,1360,1361],{},"Return navigation information without exposing database internals.",[389,1363,1365],{"id":1364},"api-evolution","API evolution",[398,1367,1368,1371,1374,1377,1380],{},[401,1369,1370],{},"Add optional response fields when clients tolerate unknown fields.",[401,1372,1373],{},"Avoid changing the meaning or type of existing fields.",[401,1375,1376],{},"Make new request fields optional or provide a transition path.",[401,1378,1379],{},"Version only when compatibility cannot be maintained, and document the support policy.",[401,1381,1382],{},"Test the contract from the client's point of view.",[389,1384,1386],{"id":1385},"common-mistakes","Common mistakes",[398,1388,1389,1400,1410,1416,1422],{},[401,1390,1391,1399],{},[1392,1393,1394,1395,1398],"strong",{},"Returning ",[439,1396,1397],{},"200"," for every outcome:"," clients must parse messages to know what happened.",[401,1401,1402,1409],{},[1392,1403,1404,1405,1408],{},"Using ",[439,1406,1407],{},"map[string]any"," for stable contracts:"," type guarantees and documentation disappear.",[401,1411,1412,1415],{},[1392,1413,1414],{},"Leaking internal errors:"," attackers gain details and clients become coupled to implementation text.",[401,1417,1418,1421],{},[1392,1419,1420],{},"Ignoring body limits:"," one request can consume excessive memory or disk.",[401,1423,1424,1427],{},[1392,1425,1426],{},"Paginating without a deterministic order:"," records can be skipped or repeated unpredictably.",[389,1429,1431],{"id":1430},"practice","Practice",[394,1433,1434,1435,1438,1439,1442,1443,1446],{},"Design and implement ",[439,1436,1437],{},"POST \u002Flessons"," and ",[439,1440,1441],{},"GET \u002Flessons\u002F{id}",". Reject a missing title, reject unknown fields, limit body size, return a stable validation error, set ",[439,1444,1445],{},"Location"," on creation, and test every status code.",[1448,1449,1450],"accordion",{},[1451,1452,1455,1943],"accordion-item",{"icon":1453,"label":1454},"i-lucide-lightbulb","Show handler outline",[431,1456,1458],{"className":489,"code":1457,"language":491,"meta":437,"style":437},"func (h *Handler) createLesson(w http.ResponseWriter, r *http.Request) {\n    var request createLessonRequest\n    if err := decodeJSON(w, r, &request); err != nil {\n        h.writeError(w, http.StatusBadRequest, \"invalid_json\", \"Request body is not valid JSON.\", nil)\n        return\n    }\n\n    request.Title = strings.TrimSpace(request.Title)\n    if request.Title == \"\" {\n        h.writeError(w, http.StatusUnprocessableEntity, \"validation_failed\", \"Check the highlighted fields.\", map[string]string{\n            \"title\": \"Title is required.\",\n        })\n        return\n    }\n\n    lesson, err := h.lessons.Create(r.Context(), request.Title)\n    if err != nil {\n        h.handleApplicationError(w, err)\n        return\n    }\n\n    w.Header().Set(\"Location\", \"\u002Flessons\u002F\"+url.PathEscape(lesson.ID))\n    _ = writeJSON(w, http.StatusCreated, toLessonResponse(lesson))\n}\n",[439,1459,1460,1507,1518,1554,1601,1606,1610,1614,1644,1662,1717,1740,1745,1749,1753,1757,1802,1815,1835,1840,1845,1850,1904,1938],{"__ignoreMap":437},[495,1461,1462,1464,1467,1470,1473,1476,1478,1481,1483,1485,1487,1489,1491,1493,1495,1497,1499,1501,1503,1505],{"class":497,"line":498},[495,1463,635],{"class":501},[495,1465,1466],{"class":512}," (",[495,1468,1469],{"class":645},"h ",[495,1471,1472],{"class":501},"*",[495,1474,1475],{"class":505},"Handler",[495,1477,682],{"class":512},[495,1479,1480],{"class":638}," createLesson",[495,1482,642],{"class":512},[495,1484,646],{"class":645},[495,1486,649],{"class":505},[495,1488,603],{"class":512},[495,1490,654],{"class":505},[495,1492,657],{"class":512},[495,1494,660],{"class":645},[495,1496,663],{"class":501},[495,1498,666],{"class":505},[495,1500,603],{"class":512},[495,1502,671],{"class":505},[495,1504,682],{"class":512},[495,1506,513],{"class":512},[495,1508,1509,1512,1515],{"class":497,"line":516},[495,1510,1511],{"class":501},"    var",[495,1513,1514],{"class":519}," request",[495,1516,1517],{"class":505}," createLessonRequest\n",[495,1519,1520,1522,1524,1526,1528,1530,1532,1534,1536,1538,1541,1544,1546,1548,1550,1552],{"class":497,"line":538},[495,1521,789],{"class":788},[495,1523,792],{"class":519},[495,1525,748],{"class":700},[495,1527,639],{"class":638},[495,1529,642],{"class":512},[495,1531,646],{"class":519},[495,1533,657],{"class":512},[495,1535,660],{"class":519},[495,1537,657],{"class":512},[495,1539,1540],{"class":501}," &",[495,1542,1543],{"class":519},"request",[495,1545,810],{"class":512},[495,1547,792],{"class":519},[495,1549,815],{"class":729},[495,1551,819],{"class":818},[495,1553,513],{"class":512},[495,1555,1556,1559,1561,1564,1566,1568,1570,1572,1574,1577,1579,1581,1584,1586,1588,1590,1593,1595,1597,1599],{"class":497,"line":544},[495,1557,1558],{"class":519},"        h",[495,1560,603],{"class":512},[495,1562,1563],{"class":638},"writeError",[495,1565,642],{"class":512},[495,1567,646],{"class":519},[495,1569,657],{"class":512},[495,1571,649],{"class":519},[495,1573,603],{"class":512},[495,1575,1576],{"class":519},"StatusBadRequest",[495,1578,657],{"class":512},[495,1580,1040],{"class":527},[495,1582,1583],{"class":531},"invalid_json",[495,1585,839],{"class":527},[495,1587,657],{"class":512},[495,1589,1040],{"class":527},[495,1591,1592],{"class":531},"Request body is not valid JSON.",[495,1594,839],{"class":527},[495,1596,657],{"class":512},[495,1598,819],{"class":818},[495,1600,736],{"class":512},[495,1602,1603],{"class":497,"line":551},[495,1604,1605],{"class":788},"        return\n",[495,1607,1608],{"class":497,"line":563},[495,1609,859],{"class":512},[495,1611,1612],{"class":497,"line":580},[495,1613,548],{"emptyLinePlaceholder":547},[495,1615,1616,1619,1621,1624,1626,1629,1631,1634,1636,1638,1640,1642],{"class":497,"line":594},[495,1617,1618],{"class":519},"    request",[495,1620,603],{"class":512},[495,1622,1623],{"class":519},"Title",[495,1625,701],{"class":700},[495,1627,1628],{"class":519}," strings",[495,1630,603],{"class":512},[495,1632,1633],{"class":638},"TrimSpace",[495,1635,642],{"class":512},[495,1637,1543],{"class":519},[495,1639,603],{"class":512},[495,1641,1623],{"class":519},[495,1643,736],{"class":512},[495,1645,1646,1648,1650,1652,1654,1657,1660],{"class":497,"line":616},[495,1647,789],{"class":788},[495,1649,1514],{"class":519},[495,1651,603],{"class":512},[495,1653,1623],{"class":519},[495,1655,1656],{"class":729}," ==",[495,1658,1659],{"class":527}," \"\"",[495,1661,513],{"class":512},[495,1663,1664,1666,1668,1670,1672,1674,1676,1678,1680,1683,1685,1687,1690,1692,1694,1696,1699,1701,1703,1706,1708,1710,1712,1714],{"class":497,"line":862},[495,1665,1558],{"class":519},[495,1667,603],{"class":512},[495,1669,1563],{"class":638},[495,1671,642],{"class":512},[495,1673,646],{"class":519},[495,1675,657],{"class":512},[495,1677,649],{"class":519},[495,1679,603],{"class":512},[495,1681,1682],{"class":519},"StatusUnprocessableEntity",[495,1684,657],{"class":512},[495,1686,1040],{"class":527},[495,1688,1689],{"class":531},"validation_failed",[495,1691,839],{"class":527},[495,1693,657],{"class":512},[495,1695,1040],{"class":527},[495,1697,1698],{"class":531},"Check the highlighted fields.",[495,1700,839],{"class":527},[495,1702,657],{"class":512},[495,1704,1705],{"class":501}," map",[495,1707,1168],{"class":512},[495,1709,1171],{"class":523},[495,1711,1174],{"class":512},[495,1713,1171],{"class":523},[495,1715,1716],{"class":512},"{\n",[495,1718,1719,1722,1725,1727,1730,1732,1735,1737],{"class":497,"line":867},[495,1720,1721],{"class":527},"            \"",[495,1723,1724],{"class":531},"title",[495,1726,839],{"class":527},[495,1728,1729],{"class":512},":",[495,1731,1040],{"class":527},[495,1733,1734],{"class":531},"Title is required.",[495,1736,839],{"class":527},[495,1738,1739],{"class":512},",\n",[495,1741,1742],{"class":497,"line":920},[495,1743,1744],{"class":512},"        })\n",[495,1746,1747],{"class":497,"line":944},[495,1748,1605],{"class":788},[495,1750,1751],{"class":497,"line":949},[495,1752,859],{"class":512},[495,1754,1755],{"class":497,"line":958},[495,1756,548],{"emptyLinePlaceholder":547},[495,1758,1760,1763,1765,1767,1769,1772,1774,1777,1779,1782,1784,1786,1788,1791,1794,1796,1798,1800],{"class":497,"line":1759},16,[495,1761,1762],{"class":519},"    lesson",[495,1764,657],{"class":512},[495,1766,792],{"class":519},[495,1768,748],{"class":700},[495,1770,1771],{"class":519}," h",[495,1773,603],{"class":512},[495,1775,1776],{"class":519},"lessons",[495,1778,603],{"class":512},[495,1780,1781],{"class":638},"Create",[495,1783,642],{"class":512},[495,1785,761],{"class":519},[495,1787,603],{"class":512},[495,1789,1790],{"class":638},"Context",[495,1792,1793],{"class":512},"(),",[495,1795,1514],{"class":519},[495,1797,603],{"class":512},[495,1799,1623],{"class":519},[495,1801,736],{"class":512},[495,1803,1805,1807,1809,1811,1813],{"class":497,"line":1804},17,[495,1806,789],{"class":788},[495,1808,792],{"class":519},[495,1810,815],{"class":729},[495,1812,819],{"class":818},[495,1814,513],{"class":512},[495,1816,1818,1820,1822,1825,1827,1829,1831,1833],{"class":497,"line":1817},18,[495,1819,1558],{"class":519},[495,1821,603],{"class":512},[495,1823,1824],{"class":638},"handleApplicationError",[495,1826,642],{"class":512},[495,1828,646],{"class":519},[495,1830,657],{"class":512},[495,1832,792],{"class":519},[495,1834,736],{"class":512},[495,1836,1838],{"class":497,"line":1837},19,[495,1839,1605],{"class":788},[495,1841,1843],{"class":497,"line":1842},20,[495,1844,859],{"class":512},[495,1846,1848],{"class":497,"line":1847},21,[495,1849,548],{"emptyLinePlaceholder":547},[495,1851,1853,1855,1857,1859,1861,1863,1865,1867,1869,1871,1873,1875,1878,1880,1883,1886,1888,1891,1893,1896,1898,1901],{"class":497,"line":1852},22,[495,1854,1015],{"class":519},[495,1856,603],{"class":512},[495,1858,1020],{"class":638},[495,1860,1023],{"class":512},[495,1862,1026],{"class":638},[495,1864,642],{"class":512},[495,1866,839],{"class":527},[495,1868,1445],{"class":531},[495,1870,839],{"class":527},[495,1872,657],{"class":512},[495,1874,1040],{"class":527},[495,1876,1877],{"class":531},"\u002Flessons\u002F",[495,1879,839],{"class":527},[495,1881,1882],{"class":501},"+",[495,1884,1885],{"class":519},"url",[495,1887,603],{"class":512},[495,1889,1890],{"class":638},"PathEscape",[495,1892,642],{"class":512},[495,1894,1895],{"class":519},"lesson",[495,1897,603],{"class":512},[495,1899,1900],{"class":519},"ID",[495,1902,1903],{"class":512},"))\n",[495,1905,1907,1910,1912,1914,1916,1918,1920,1922,1924,1927,1929,1932,1934,1936],{"class":497,"line":1906},23,[495,1908,1909],{"class":519},"    _",[495,1911,701],{"class":700},[495,1913,979],{"class":638},[495,1915,642],{"class":512},[495,1917,646],{"class":519},[495,1919,657],{"class":512},[495,1921,649],{"class":519},[495,1923,603],{"class":512},[495,1925,1926],{"class":519},"StatusCreated",[495,1928,657],{"class":512},[495,1930,1931],{"class":638}," toLessonResponse",[495,1933,642],{"class":512},[495,1935,1895],{"class":519},[495,1937,1903],{"class":512},[495,1939,1941],{"class":497,"line":1940},24,[495,1942,541],{"class":512},[394,1944,1945,1947,1948,1951],{},[439,1946,1824],{}," maps known domain errors to safe public responses and logs unexpected errors at the boundary. Tests should use ",[439,1949,1950],{},"httptest"," and assert status, headers, and decoded JSON—not private helper calls.",[389,1953,1955],{"id":1954},"summary","Summary",[398,1957,1958,1961,1964,1967,1970],{},[401,1959,1960],{},"Treat paths, methods, status codes, headers, and bodies as a versioned contract.",[401,1962,1963],{},"Keep transport types separate from business and storage representations.",[401,1965,1966],{},"Bound and validate all input.",[401,1968,1969],{},"Return stable machine-readable errors without leaking internal details.",[401,1971,1972],{},"Test behaviour through HTTP rather than only testing private helpers.",[1974,1975],"learning-lesson-complete",{},[1977,1978],"learning-lesson-navigation",{"next":211,"next-label":210,"previous":191,"previous-label":190},[1980,1981,1982],"style",{},"html pre.shiki code .sEOdo, html code.shiki .sEOdo{--shiki-light:#859900;--shiki-default:#89DDFF;--shiki-dark:#C678DD}html pre.shiki code .snwKR, html code.shiki .snwKR{--shiki-light:#CB4B16;--shiki-default:#FFCB6B;--shiki-dark:#E5C07B}html pre.shiki code .shFME, html code.shiki .shFME{--shiki-light:#657B83;--shiki-default:#89DDFF;--shiki-dark:#ABB2BF}html pre.shiki code .s45-6, html code.shiki .s45-6{--shiki-light:#268BD2;--shiki-default:#EEFFFF;--shiki-dark:#E06C75}html pre.shiki code .sF6sA, html code.shiki .sF6sA{--shiki-light:#586E75;--shiki-light-font-weight:bold;--shiki-default:#C792EA;--shiki-default-font-weight:inherit;--shiki-dark:#C678DD;--shiki-dark-font-weight:inherit}html pre.shiki code .sED5a, html code.shiki .sED5a{--shiki-light:#2AA198;--shiki-default:#89DDFF;--shiki-dark:#98C379}html pre.shiki code .sVazx, html code.shiki .sVazx{--shiki-light:#2AA198;--shiki-default:#C3E88D;--shiki-dark:#98C379}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sisdC, html code.shiki .sisdC{--shiki-light:#268BD2;--shiki-default:#82AAFF;--shiki-dark:#61AFEF}html pre.shiki code .syre3, html code.shiki .syre3{--shiki-light:#657B83;--shiki-light-font-style:inherit;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#E06C75;--shiki-dark-font-style:italic}html pre.shiki code .su2KV, html code.shiki .su2KV{--shiki-light:#859900;--shiki-default:#89DDFF;--shiki-dark:#E5C07B}html pre.shiki code .sAJzr, html code.shiki .sAJzr{--shiki-light:#D33682;--shiki-default:#F78C6C;--shiki-dark:#D19A66}html pre.shiki code .sRBoR, html code.shiki .sRBoR{--shiki-light:#859900;--shiki-default:#89DDFF;--shiki-dark:#56B6C2}html pre.shiki code .s7Bcg, html code.shiki .s7Bcg{--shiki-light:#859900;--shiki-light-font-style:inherit;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#C678DD;--shiki-dark-font-style:inherit}html pre.shiki code .sp8Z5, html code.shiki .sp8Z5{--shiki-light:#B58900;--shiki-default:#89DDFF;--shiki-dark:#D19A66}html pre.shiki code .st3jj, html code.shiki .st3jj{--shiki-light:#CB4B16;--shiki-default:#F07178;--shiki-dark:#D19A66}",{"title":437,"searchDepth":516,"depth":516,"links":1984},[1985,1986,1987,1988,1989,1990,1991,1992,1993,1994,1995,1996,1997,1998],{"id":391,"depth":516,"text":392},{"id":418,"depth":516,"text":419},{"id":428,"depth":516,"text":429},{"id":446,"depth":516,"text":447},{"id":485,"depth":516,"text":486},{"id":624,"depth":516,"text":625},{"id":966,"depth":516,"text":967},{"id":1110,"depth":516,"text":1111},{"id":1207,"depth":516,"text":1208},{"id":1354,"depth":516,"text":1355},{"id":1364,"depth":516,"text":1365},{"id":1385,"depth":516,"text":1386},{"id":1430,"depth":516,"text":1431},{"id":1954,"depth":516,"text":1955},"Design predictable resources, methods, status codes, JSON contracts, and error responses.","md",null,{},{"icon":208},{"description":2005,"title":205},"Learn practical HTTP API design in Go with resources, methods, status codes, JSON contracts, pagination, idempotency, and tests.","ob9H9Gt2XapcQ6F0hRTSMRlMOq4i7_FSN394PL1W7wk",[2008,2010],{"title":200,"path":201,"stem":202,"description":2009,"icon":203,"children":-1},"Review correctness, security, operability, deployment, and recovery before serving real traffic.",{"title":210,"path":211,"stem":212,"description":2011,"icon":213,"children":-1},"Wrap HTTP handlers for shared behaviour while preserving correctness and clear ordering.",1794118101534]