def methods(*args):
"""
1. Ensures only limited HTTP methods are supported. (for served models)
2. Register service function with only certain method on given @url
"""
def decorator(funcOrModel):
if type(funcOrModel) is DjangoModel:
funcOrModel._express_dispatcher = require_http_methods(args)(funcOrModel._express_dispatcher)
else:
funcOrModel._methods = args # this will be used later upon autodiscover() for creating service dispatcher (per url).
return funcOrModel
return decorator