Skip to content

SeraphSecure/bodies

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bodies

Utility package to combine mold and validator in Fiber.

Installation

To install:

  • For Fiber v2, run go get -u github.com/seraphsecure/bodies/v2
  • For Fiber v3, run go get -u github.com/seraphsecure/bodies/v3

Example

type requestFoo struct {
	Name string `json:"name" mod:"trim" validate:"required"`
}

func MyRequest(c fiber.Ctx) error {
	body, err := bodies.ParseModValidate[requestFoo](c)
	if err != nil {
		return err
	}
	return c.SendString(fmt.Sprintf("Hello, %s!", body.Name))
}

About

Utility package to combine mold and validator in Fiber.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages