registering multiple routes in sammy.js

1.5k Views Asked by At

I want to register multiple routes for one callback like below. I sperated them with "," character just for show what i mean. Is it possible to do such a thing ?

this.get('/Posts/MostVoteds, /Posts/Mostpopular, /Posts/blabla', function (ctx) {

        });
1

There are 1 best solutions below

0
On BEST ANSWER

As soon as paths could be defined both as strings and regular expressions you could try merging paths mentioned in a single regular expression, i.e.

this.get(/^\/Posts\/(MostVoteds|Mostpopular|blabla)/, function (ctx) {
    // some code here
});