jfromaniello / express-unless

Conditionally add a middleware to express with some common patterns
MIT License
178 stars 27 forks source link

How can I use RegExp? #7

Closed burakkilic closed 9 years ago

burakkilic commented 9 years ago

Hi;

I tried to use RegExp like

.unless({
    path: ['/auth/login', '/auth/signup', '^\/auth\/reset\/[A-Za-z0-9-_]*']
}))

to let /auth/reset/46b957ea7272a916f5d71e79d7fde7dab7a91414

but it is not allowed. How can I do that?

MarkusPint commented 9 years ago

Remove the ' ' from around the RegExp. Right now your RegExp is being read as a string.

burakkilic commented 9 years ago

Thank you.