Home

Awesome

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);