Skip to content
This repository has been archived by the owner on Jul 19, 2021. It is now read-only.
/ Red.Validation Public archive

Extensions for FormValidator for creating Red middleware

License

Notifications You must be signed in to change notification settings

RedHttp/Red.Validation

Repository files navigation

The RedHttp project is no longer maintained. See Carter for a similar low-ceremony experience.

Red.Validation

Extensions for FormValidator for creating Red middleware

GitHub Nuget Nuget Dependent repos (via libraries.io)

Example

Create middleware function

public static readonly Func<Request, Response, Task<HandlerType>> ValidateLoginForm = ValidatorBuilder.New()
    .RequiresString("username", s => WithLength(s, MinUsernameLength, MaxUsernameLength))
    .RequiresString("password", s => WithLength(s, MinPasswordLength, MaxPasswordLength))
    .BuildRedFormMiddleware();

And then use it

server.Get("/login", ValidateLoginForm, PerformLogin);

Releases

No releases published

Packages

No packages published

Languages