delvedor/find-my-way

Add constraint outside the constructor

matthyk opened this issue · 2 comments

Currently, constraints can only be added when creating the FindMyWay instance. It would be very useful to be able to add more constraints later via a method like addConstraint. With regard to Fastify, this would allow plugins to add constraints without the developer having to specify the constraint itself when creating the Fastify instance.

const router = require('find-my-way')()

router.addConstraint(...)

Is this even implementable and if so is it desirable to have such functionality?

I don't see any problem with adding this. Sounds like a good idea.

Nice! Then I'll try to implement it!