code: def add_resource(self, resource, *class_args, **class_kwargs):
          
          name = resource.__name__.lower()
          meta_resource = parse_docs(resource.__doc__, ["$shared"])
          self.meta[name] = meta_resource
          shared = self.meta["$shared"].copy()
          shared.update(meta_resource.get("$shared", {}))
          with MarkKey("%s.$shared" % resource.__name__):
              sp = SchemaParser(validators=self.validators, shared=shared)
          with MarkKey(resource.__name__):
              resource = resource(*class_args, **class_kwargs)
              # group actions by it's name, and
              # make action group a view function
              actions = defaultdict(lambda: {})
              for action in dir(resource):
                  find = PATTERN_ACTION.findall(action)
                  if not find:
                      continue
                  httpmethod, action_name = find[0]
                  action_group = actions[action_name]
                  fn = getattr(resource, action)
                  meta_action = parse_docs(
                      fn.__doc__, ["$input", "$output", "$error"])
                  meta_resource[action] = meta_action
                  with MarkKey(fn.__name__):
                      action_group[httpmethod] = \
                          self.make_action(fn, sp, meta_action)
  
          for action_name in actions:
              if action_name == "":
                  url = "/" + name
                  endpoint = name
              else:
                  url = "/{0}/{1}".format(name, action_name)
                  endpoint = "{0}@{1}".format(name, action_name)
              action_group = actions[action_name]
              self.app.add_url_rule(
                  url, endpoint=endpoint,
                  view_func=self.make_view(action_group),
                  methods=set(action_group)
              )
docs: Add resource
  
          Parse resource and it's actions, route actions by naming rule.
  
          Args:
              resource: resource class
              class_args: class_args
              class_kwargs: class_kwargs