def register_resource(mod, view, **kwargs):
    """Register the resource on the resource name or a custom url"""
    resource_name = view.__name__.lower()[:-8]
    endpoint = kwargs.get('endpoint', "{}_api".format(resource_name))
    plural_resource_name = inflect.engine().plural(resource_name)
    path = kwargs.get('url', plural_resource_name).strip('/')
    url = '/{}'.format(path)
    setattr(view, '_url', url)  # need this for 201 location header
    view_func = view.as_view(endpoint)

    mod.add_url_rule(url, view_func=view_func,
                     methods=['GET', 'POST', 'OPTIONS'])
    mod.add_url_rule('{}/<obj_id>'.format(url),
                     view_func=view_func,
                     methods=['GET', 'PATCH', 'PUT', 'DELETE', 'OPTIONS'])
Register the resource on the resource name or a custom url