Skip to content

Commit 67533e1

Browse files
committed
πŸ§‘β€πŸ”§ Typo
1 parent 2d09dbe commit 67533e1

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

β€Ždocs/docs/error-handling/index.htmlβ€Ž

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,11 @@
197197
</span></span><span class=line><span class=cl>
198198
</span></span><span class=line><span class=cl> <span class=nx>r</span><span class=p>.</span><span class=nf>Route</span><span class=p>(</span><span class=s>&#34;/v1&#34;</span><span class=p>,</span> <span class=kd>func</span><span class=p>(</span><span class=nx>r</span> <span class=nx>chi</span><span class=p>.</span><span class=nx>Router</span><span class=p>)</span> <span class=p>{</span>
199199
</span></span><span class=line><span class=cl> <span class=nx>bookAPI</span> <span class=o>:=</span> <span class=nx>book</span><span class=p>.</span><span class=nf>New</span><span class=p>(</span><span class=nx>db</span><span class=p>,</span> <span class=nx>v</span><span class=p>)</span>
200-
</span></span></code></pre></div><h3 id=6-update-cmdapimaingo>6. Update <code>cmd/api/main.go</code></h3><div class=highlight><pre tabindex=0 class=chroma><code class=language-go data-lang=go><span class=line><span class=cl><span class=kn>import</span> <span class=nx>validatorUil</span> <span class=s>&#34;myapp/util/validator&#34;</span>
200+
</span></span></code></pre></div><h3 id=6-update-cmdapimaingo>6. Update <code>cmd/api/main.go</code></h3><div class=highlight><pre tabindex=0 class=chroma><code class=language-go data-lang=go><span class=line><span class=cl><span class=kn>import</span> <span class=nx>validatorUtil</span> <span class=s>&#34;myapp/util/validator&#34;</span>
201201
</span></span><span class=line><span class=cl>
202202
</span></span><span class=line><span class=cl><span class=kd>func</span> <span class=nf>main</span><span class=p>()</span> <span class=p>{</span>
203203
</span></span><span class=line><span class=cl> <span class=nx>c</span> <span class=o>:=</span> <span class=nx>config</span><span class=p>.</span><span class=nf>New</span><span class=p>()</span>
204-
</span></span><span class=line><span class=cl> <span class=nx>v</span> <span class=o>:=</span> <span class=nx>validatorUil</span><span class=p>.</span><span class=nf>New</span><span class=p>()</span>
204+
</span></span><span class=line><span class=cl> <span class=nx>v</span> <span class=o>:=</span> <span class=nx>validatorUtil</span><span class=p>.</span><span class=nf>New</span><span class=p>()</span>
205205
</span></span><span class=line><span class=cl>
206206
</span></span><span class=line><span class=cl> <span class=kd>var</span> <span class=nx>logLevel</span> <span class=nx>gormlogger</span><span class=p>.</span><span class=nx>LogLevel</span>
207207
</span></span><span class=line><span class=cl> <span class=k>if</span> <span class=nx>c</span><span class=p>.</span><span class=nx>DB</span><span class=p>.</span><span class=nx>Debug</span> <span class=p>{</span>
@@ -412,6 +412,6 @@
412412
</span></span><span class=line><span class=cl>β”‚
413413
</span></span><span class=line><span class=cl>β”œβ”€β”€ compose.yml
414414
</span></span><span class=line><span class=cl>└── Dockerfile
415-
</span></span></code></pre></div><h2 id=-whats-next>πŸ‘¨β€πŸ« What&rsquo;s next…</h2><p>In the next article, we’ll add the request logs, error logs and the logger to our application.</p></div><footer><time datetime=2025-06-29><i>πŸ•’</i> Updated: 2025-06-29</time>
415+
</span></span></code></pre></div><h2 id=-whats-next>πŸ‘¨β€πŸ« What&rsquo;s next…</h2><p>In the next article, we’ll add the request logs, error logs and the logger to our application.</p></div><footer><time datetime=2025-07-14><i>πŸ•’</i> Updated: 2025-07-14</time>
416416
<a href=https://learning-cloud-native-go.github.io/docs/repository/><i>οΉ€</i> Previous</a>
417417
<a class=hidden>Next <i>οΉ₯</i></a></footer></article><aside><div><button class=btn><i>❌</i>Close</button></div><strong>On this page</strong><nav id=TableOfContents><ul><li><a href=#adding-error-messages-to-the-api>Adding error messages to the API</a><ul><li><a href=#1-identify-and-standardize-errors>1. Identify and standardize errors</a></li><li><a href=#2-define-helper-functions>2. Define helper functions</a></li><li><a href=#3-update-api-handlers>3. Update API handlers</a></li></ul></li><li><a href=#adding-validator-to-the-api>Adding validator to the API</a><ul><li><a href=#1-add-go-playgroundvalidator>1. Add <code>go-playground/validator</code></a></li><li><a href=#2-set-validation-tags>2. Set validation tags</a></li><li><a href=#3-add-utilvalidatorvalidatorgo>3. Add <code>util/validator/validator.go</code></a></li><li><a href=#4-add-validator-as-an-api-dependency>4. Add validator as an API dependency</a></li><li><a href=#5-update-router>5. Update router</a></li><li><a href=#6-update-cmdapimaingo>6. Update <code>cmd/api/main.go</code></a></li><li><a href=#7--run-go-mod-tidy>7. Run <code>go mod tidy</code></a></li></ul></li><li><a href=#using-validator-from-handlers>Using validator from handlers</a><ul><li><a href=#1-add-utilvalidatorresponsego>1. Add <code>util/validator/response.go</code></a></li><li><a href=#2-update-handlers>2. Update handlers</a></li></ul></li><li><a href=#-final-project-structure>πŸ“ Final project structure</a></li><li><a href=#-whats-next>πŸ‘¨β€πŸ« What&rsquo;s next…</a></li></ul></nav></aside></main><footer><div><i>πŸ§‘β€πŸ’»</i>Built by and copyright<a href=https://github.com/dumindu target=_blank>Dumindu Madunuwan</a><i>πŸ“…</i> 2019-2025<i>πŸš€</i> <a href=https://github.com/learning-cloud-native-go target=_blank>GitHub</a></div><div><button class=btn><i>β˜€οΈ</i><i>⁄</i><i>πŸŒ‘</i></button></div></footer></div></div><div id=body-model-outer></div><script type=text/javascript src=/assets/js/docs.min.12ffdc25c0149ef34e761ee54587f2aae17affcb8375298ad2180851930cb142.js integrity></script></body></html>

β€Ždocs/sitemap.xmlβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<?xml version="1.0" encoding="utf-8" standalone="yes"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml"><url><loc>https://learning-cloud-native-go.github.io/docs/building-a-dockerized-restful-api-application-in-go/</loc><lastmod>2024-01-21T18:12:51+08:00</lastmod></url><url><loc>https://learning-cloud-native-go.github.io/categories/</loc></url><url><loc>https://learning-cloud-native-go.github.io/docs/configurations/</loc><lastmod>2025-06-29T17:50:50+08:00</lastmod></url><url><loc>https://learning-cloud-native-go.github.io/docs/database-and-migrations/</loc><lastmod>2025-06-29T17:50:50+08:00</lastmod></url><url><loc>https://learning-cloud-native-go.github.io/docs/</loc><lastmod>2025-06-29T17:50:50+08:00</lastmod></url><url><loc>https://learning-cloud-native-go.github.io/docs/error-handling/</loc><lastmod>2025-06-29T17:50:50+08:00</lastmod></url><url><loc>https://learning-cloud-native-go.github.io/docs/hello-world-server/</loc><lastmod>2025-06-29T17:50:50+08:00</lastmod></url><url><loc>https://learning-cloud-native-go.github.io/</loc><lastmod>2025-06-29T17:50:50+08:00</lastmod></url><url><loc>https://learning-cloud-native-go.github.io/docs/overview/</loc><lastmod>2024-03-17T23:18:06+08:00</lastmod></url><url><loc>https://learning-cloud-native-go.github.io/docs/repository/</loc><lastmod>2025-06-29T17:50:50+08:00</lastmod></url><url><loc>https://learning-cloud-native-go.github.io/docs/routes-and-openapi-specification/</loc><lastmod>2025-06-29T17:50:50+08:00</lastmod></url><url><loc>https://learning-cloud-native-go.github.io/tags/</loc></url></urlset>
1+
<?xml version="1.0" encoding="utf-8" standalone="yes"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml"><url><loc>https://learning-cloud-native-go.github.io/docs/building-a-dockerized-restful-api-application-in-go/</loc><lastmod>2024-01-21T18:12:51+08:00</lastmod></url><url><loc>https://learning-cloud-native-go.github.io/categories/</loc></url><url><loc>https://learning-cloud-native-go.github.io/docs/configurations/</loc><lastmod>2025-06-29T17:50:50+08:00</lastmod></url><url><loc>https://learning-cloud-native-go.github.io/docs/database-and-migrations/</loc><lastmod>2025-06-29T17:50:50+08:00</lastmod></url><url><loc>https://learning-cloud-native-go.github.io/docs/</loc><lastmod>2025-07-14T21:45:11+08:00</lastmod></url><url><loc>https://learning-cloud-native-go.github.io/docs/error-handling/</loc><lastmod>2025-07-14T21:45:11+08:00</lastmod></url><url><loc>https://learning-cloud-native-go.github.io/docs/hello-world-server/</loc><lastmod>2025-06-29T17:50:50+08:00</lastmod></url><url><loc>https://learning-cloud-native-go.github.io/</loc><lastmod>2025-07-14T21:45:11+08:00</lastmod></url><url><loc>https://learning-cloud-native-go.github.io/docs/overview/</loc><lastmod>2024-03-17T23:18:06+08:00</lastmod></url><url><loc>https://learning-cloud-native-go.github.io/docs/repository/</loc><lastmod>2025-06-29T17:50:50+08:00</lastmod></url><url><loc>https://learning-cloud-native-go.github.io/docs/routes-and-openapi-specification/</loc><lastmod>2025-06-29T17:50:50+08:00</lastmod></url><url><loc>https://learning-cloud-native-go.github.io/tags/</loc></url></urlset>

0 commit comments

Comments
Β (0)