danieldaeschle / swapy

Easy and modular web development

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Regex for Routing

100Errors opened this issue · comments

Submitting...

  • Feature

Hey there,
what about regular expressions for routing? or something like:

@swapy.on('/api/v1/{param_id}/new')
def newParam(args):

    return args['param_id']

or optional parameters:

@swapy.on('/api/v1/[/{param_id}]')
def optionalParam(args):

    return args['param_id'];

'/api/v1/{param_id}/new' isn't regex. it's just url parameters. yes it is supported.

optional parameters can be achieved by using two routes.

@swapy.on('/api/v1')
@swapy.on('/api/v1/:id')
def something(): pass

Do you mean something like: \/api(\/v1)? to match /api/v1 and /api as example?

I mean both :)