💭 How to make clear & pretty error messages from the Go backend to your frontend?

This page summarizes the projects mentioned and recommended in the original post on dev.to

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • validator

    :100:Go Struct and Field validation, including Cross Field, Cross Struct, Map, Slice and Array diving

  • We will take a look at package go-playground/validator v10, which is almost the number one choice for such problems in Go.

  • uuid

    Go package for UUIDs based on RFC 4122 and DCE 1.1: Authentication and Security Services. (by google)

  • So, we have a field with type uuid.UUID which we create with the package google/uuid, which we want to check with the built-in validator uuid.Parse() of that package. All we need to do is add a new RegisterValidation method to the NewValidator function (described above) with simple logic code:

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • Fiber

    ⚡️ Express inspired web framework written in Go

  • Furthermore, in the example below, I took code from my project written using the Fiber web framework. So, some elements from its libraries are present there. Don't be scared, the main thing here is to understand the principle of validation itself.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts