문제

I'm trying to route multiple wild card urls to the same function in express. I think I need some sort of regex, but I'm not sure how to do it.

I want do something like this:

app.route(['scripts/*', 'styles/*', 'images/*']).get(handler);
도움이 되었습니까?

해결책

Found a way to do it:

app.route('/:url(api|components|scripts|styles|bower_components|images)/*')
   .get(errors[404]);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top