node-restful icon indicating copy to clipboard operation
node-restful copied to clipboard

Before middleware called several times

Open Tizianol8 opened this issue 10 years ago • 1 comments

If you define a custom route without any methods, for example: Resource.route('recommend', fn); and you define a 'before' middleware, for example: Resource.before('recommend', fn); the before middleware is called 4 times when you make one GET request to /resources/recommed.

Tizianol8 avatar Apr 23 '15 09:04 Tizianol8

We actually have tests that assert they're only called once.

Part of the problem might be that you're registering the same function fn? That function will get called twice -- once to handle the route and once before the route. Your example doesn't actually make sense to me...

baugarten avatar Nov 24 '15 15:11 baugarten