The RedHttp project is no longer maintained. See Carter for a similar low-ceremony experience.
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);