Closed kibertoad closed 5 years ago
@kibertoad, i thought you wanted something to control the route through the middleware. like this
app.post("/echo", validator.validate("post", "/echo"), (req, res, next) => {
res.json({ output: req.body.input });
});
btw, you'd only need to pass the request, as the middleware has access to the request method from req, so it would look like this.
app.post("/echo", validator.validate({route: "/echo"}), (req, res, next) => {
res.json({ output: req.body.input });
});
anyway, as with this change we'll need a validate function that returns validate middleware so it could receive the configuration, this would be a breaking change.
@kobik Fair point. Can we postpone it till 2.0.0 then? It's not really that high priority feature for me, I'd much rather #69 landed faster.
@kibertoad I have no problem with that
@kobik Is everything ready for 1.0.0 then?
@kibertoad i think we should close this MR for now and until we agree on how we solve it.
@kobik Makes sense :)
fixes #36 fixes #62
I would suggest reviewing #74 separately and first, since this once builds on what that PR introduces, but alternatively everything can be reviewed within this PR - it's a superset of #74.