def register(self, *paths, methods=None, name=None, handler=None):
        """Register function/coroutine/muffin.Handler with the application.

        Usage example:

        .. code-block:: python

            @app.register('/hello')
            def hello(request):
                return 'Hello World!'


        """
        if isinstance(methods, str):
            methods = [methods]

        def wrapper(view):
            if handler is None:

                handler_ = view
                methods_ = methods or [METH_ANY]

                if isfunction(handler_) or ismethod(handler_):
                    handler_ = Handler.from_view(view, *methods_, name=name)

                handler_.bind(self, *paths, methods=methods_, name=name)

            else:

                view_name = view.__name__
                if not hasattr(handler, view_name):
                    setattr(handler, view_name, to_coroutine(view))
                name_ = name or view_name
                handler.bind(self, *paths, methods=methods, name=name_, view=view_name)

            return view

        # Support for @app.register(func)
        if len(paths) == 1 and callable(paths[0]):
            view = paths[0]

            if isclass(view) and issubclass(view, BaseException):
                return wrapper

            paths = []
            return wrapper(view)

        return wrapper
def register ( self , * paths , methods = None , name = None , handler = None ) : if isinstance ( methods , str ) : methods = [ methods ] def wrapper ( view ) : if handler is None : handler_ = view methods_ = methods or [ METH_ANY ] if isfunction ( handler_ ) or ismethod ( handler_ ) : handler_ = Handler . from_view ( view , * methods_ , name = name ) handler_ . bind ( self , * paths , methods = methods_ , name = name ) else : view_name = view . __name__ if not hasattr ( handler , view_name ) : setattr ( handler , view_name , to_coroutine ( view ) ) name_ = name or view_name handler . bind ( self , * paths , methods = methods , name = name_ , view = view_name ) return view if len ( paths ) == 1 and callable ( paths [ 0 ] ) : view = paths [ 0 ] if isclass ( view ) and issubclass ( view , BaseException ) : return wrapper paths = [ ] return wrapper ( view ) return wrapper
Register function/coroutine/muffin.Handler with the application.

        Usage example:

        .. code-block:: python

            @app.register('/hello')
            def hello(request):
                return 'Hello World!'